summaryrefslogtreecommitdiff
path: root/main/models.py
diff options
context:
space:
mode:
Diffstat (limited to 'main/models.py')
-rw-r--r--main/models.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/main/models.py b/main/models.py
index 7ccb9245..e106313c 100644
--- a/main/models.py
+++ b/main/models.py
@@ -1,6 +1,7 @@
from django.db import models
from django.db.models import Q
from django.contrib.auth.models import User
+from django.contrib.sites.models import Site
from main.middleware import get_user
from packages.models import PackageRelation
@@ -176,6 +177,7 @@ class Package(models.Model):
last_update = models.DateTimeField(null=True, blank=True)
files_last_update = models.DateTimeField(null=True, blank=True)
license = models.CharField(max_length=255, null=True)
+
objects = PackageManager()
class Meta:
db_table = 'packages'
@@ -190,6 +192,11 @@ class Package(models.Model):
return '/packages/%s/%s/%s/' % (self.repo.name.lower(),
self.arch.name, self.pkgname)
+ def get_full_url(self, proto='http'):
+ '''get a URL suitable for things like email including the domain'''
+ domain = Site.objects.get_current().domain
+ return '%s://%s%s' % (proto, domain, self.get_absolute_url())
+
@property
def maintainers(self):
return User.objects.filter(