diff options
author | Dan McGee <dan@archlinux.org> | 2014-01-25 09:16:48 -0600 |
---|---|---|
committer | Dan McGee <dan@archlinux.org> | 2014-01-25 09:16:48 -0600 |
commit | 3faeab7d548552bfaa6719b75be9b6450b5031bd (patch) | |
tree | f195b4e92f883aebf40c6148e544c13305c344a8 /packages/models.py | |
parent | faf196aa521e794aed905122600d12f1c9ab1f0e (diff) |
Add 'Latest Update' column to stale package relations
This helps when doing the irregular cleanup of these things and making
sure a relation has been stale for some time and not just a couple
minutes or hours.
Signed-off-by: Dan McGee <dan@archlinux.org>
Diffstat (limited to 'packages/models.py')
-rw-r--r-- | packages/models.py | 9 |
1 files changed, 6 insertions, 3 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): |