summaryrefslogtreecommitdiff
path: root/main/models.py
diff options
context:
space:
mode:
authorDusty Phillips <buchuki@gmail.com>2008-10-07 11:48:58 -0400
committerDusty Phillips <buchuki@gmail.com>2008-10-07 11:48:58 -0400
commitfb9158dec8b1b735fa653c98d07f78ca14eb425c (patch)
treed922f7b323dbf535e04ebb578e99ceb83f3564bb /main/models.py
parent3d4775486e0c32cccfb0c5a480f8b629aaf60e5a (diff)
fairly invasive refactor to developer dashboard to be more django friendly
Diffstat (limited to 'main/models.py')
-rw-r--r--main/models.py24
1 files changed, 5 insertions, 19 deletions
diff --git a/main/models.py b/main/models.py
index e7566c35..a2323c62 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)