summaryrefslogtreecommitdiff
path: root/packages
diff options
context:
space:
mode:
authorLuke Shumaker <LukeShu@sbcglobal.net>2014-05-25 19:34:21 -0400
committerLuke Shumaker <LukeShu@sbcglobal.net>2014-05-25 19:34:21 -0400
commit1a1fd4a3d6aa7f6b2338f7751f5f97a30a059a04 (patch)
treef608874663d24f19ecf175ec556f2a330d47a726 /packages
parent747a562ddca10e29dd003e8b3c59f8f384d1bc8d (diff)
parentcd7222047b41ac3efa389a22fdd22148d03c1d61 (diff)
Merge tag 'release_2014-03-22' into archweb-generic
Fix long filenames; local storage for filter prefs Conflicts: templates/public/download.html
Diffstat (limited to 'packages')
-rw-r--r--packages/models.py9
-rw-r--r--packages/utils.py3
2 files changed, 8 insertions, 4 deletions
diff --git a/packages/models.py b/packages/models.py
index 6477d412..da8adc56 100644
--- a/packages/models.py
+++ b/packages/models.py
@@ -28,6 +28,9 @@ class PackageRelation(models.Model):
type = models.PositiveIntegerField(choices=TYPE_CHOICES, default=MAINTAINER)
created = models.DateTimeField(editable=False)
+ class Meta:
+ unique_together = (('pkgbase', 'user', 'type'),)
+
def get_associated_packages(self):
return Package.objects.normal().filter(pkgbase=self.pkgbase)
@@ -35,13 +38,13 @@ class PackageRelation(models.Model):
packages = self.get_associated_packages()
return sorted({p.repo for p in packages})
+ def last_update(self):
+ return Update.objects.filter(pkgbase=self.pkgbase).latest()
+
def __unicode__(self):
return u'%s: %s (%s)' % (
self.pkgbase, self.user, self.get_type_display())
- class Meta:
- unique_together = (('pkgbase', 'user', 'type'),)
-
class SignoffSpecificationManager(models.Manager):
def get_from_package(self, pkg):
diff --git a/packages/utils.py b/packages/utils.py
index 6ec39483..0f47f170 100644
--- a/packages/utils.py
+++ b/packages/utils.py
@@ -243,7 +243,8 @@ SELECT DISTINCT id
cursor = connection.cursor()
cursor.execute(sql, [PackageRelation.MAINTAINER])
to_fetch = [row[0] for row in cursor.fetchall()]
- relations = PackageRelation.objects.select_related('user').filter(
+ relations = PackageRelation.objects.select_related(
+ 'user', 'user__userprofile').filter(
id__in=to_fetch)
return relations