diff options
author | Dan McGee <dan@archlinux.org> | 2011-02-23 12:09:29 -0600 |
---|---|---|
committer | Dan McGee <dan@archlinux.org> | 2011-02-23 12:15:45 -0600 |
commit | 3181e970ce9dcc4fd996499ee536e4c2454e89dd (patch) | |
tree | 5466564b96c46c81d21140567170a4d6433f6e07 /packages/models.py | |
parent | f6c41b273c8962718b303c6050c2fd8bcea533a8 (diff) |
Add stale package relations status screen
For now it is read only. Display a few tables of various ways of
detecting stale package relations. These include inactive users, pkgbase
values that no longer exist, and users that are listed as maintainers
that don't have the proper permissions for that package anymore.
Signed-off-by: Dan McGee <dan@archlinux.org>
Diffstat (limited to 'packages/models.py')
-rw-r--r-- | packages/models.py | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/packages/models.py b/packages/models.py index 0afdee00..5dbdea45 100644 --- a/packages/models.py +++ b/packages/models.py @@ -19,6 +19,16 @@ class PackageRelation(models.Model): user = models.ForeignKey(User, related_name="package_relations") type = models.PositiveIntegerField(choices=TYPE_CHOICES, default=MAINTAINER) + def get_associated_packages(self): + # TODO: delayed import to avoid circular reference + from main.models import Package + return Package.objects.filter(pkgbase=self.pkgbase).select_related( + 'arch', 'repo') + + def repositories(self): + packages = self.get_associated_packages() + return sorted(set([p.repo for p in packages])) + def __unicode__(self): return "%s: %s (%s)" % ( self.pkgbase, self.user, self.get_type_display()) |