diff options
author | Dusty Phillips <buchuki@gmail.com> | 2008-10-07 17:48:58 +0200 |
---|---|---|
committer | Dusty Phillips <buchuki@gmail.com> | 2008-10-07 17:48:58 +0200 |
commit | fb9158dec8b1b735fa653c98d07f78ca14eb425c (patch) | |
tree | d922f7b323dbf535e04ebb578e99ceb83f3564bb /main | |
parent | 3d4775486e0c32cccfb0c5a480f8b629aaf60e5a (diff) | |
download | archweb-fb9158dec8b1b735fa653c98d07f78ca14eb425c.tar.gz archweb-fb9158dec8b1b735fa653c98d07f78ca14eb425c.tar.xz |
fairly invasive refactor to developer dashboard to be more django friendly
Diffstat (limited to 'main')
-rw-r--r-- | main/models.py | 24 |
1 files changed, 5 insertions, 19 deletions
diff --git a/main/models.py b/main/models.py index e7566c3..a2323c6 100644 --- a/main/models.py +++ b/main/models.py @@ -49,23 +49,9 @@ class TodolistManager(models.Manager): return results class PackageManager(models.Manager): - def get_flag_stats(self): - results = [] - # first the orphans - noflag = self.filter(maintainer=0) - flagged = noflag.filter( - needupdate=True).exclude( - repo__name__iexact='testing') - results.append( - (User(id=0,first_name='Orphans'), noflag.count(), flagged.count())) - # now the rest - for maint in User.objects.all().order_by('first_name'): - noflag = self.filter(maintainer=maint.id) - flagged = noflag.filter(needupdate=True).exclude( - repo__name__iexact='testing') - results.append((maint, noflag.count(), flagged.count())) - return results + def flagged(self): + return self.get_query_set().filter(needupdate=True) ############################# ### General Model Classes ### @@ -151,9 +137,9 @@ class Repo(models.Model): class Package(models.Model): id = models.AutoField(primary_key=True) - repo = models.ForeignKey(Repo) - arch = models.ForeignKey(Arch) - maintainer = models.ForeignKey(User, related_name='package_maintainer') + repo = models.ForeignKey(Repo, related_name="packages") + arch = models.ForeignKey(Arch, related_name="packages") + maintainer = models.ForeignKey(User, related_name="maintained_packages") needupdate = models.BooleanField(default=False) pkgname = models.CharField(max_length=255) pkgver = models.CharField(max_length=255) |