diff options
author | Dan McGee <dan@archlinux.org> | 2011-07-06 19:05:19 +0200 |
---|---|---|
committer | Dan McGee <dan@archlinux.org> | 2011-07-06 19:12:17 +0200 |
commit | f95abca269aec1409ec1e57de4c6cb5ba1da6369 (patch) | |
tree | 94a46c026a180790cb41c4ffce55fc330b807ce2 /main | |
parent | 4876a1258042a85d9c0a1d57a1a185f48850c929 (diff) | |
download | archweb-f95abca269aec1409ec1e57de4c6cb5ba1da6369.tar.gz archweb-f95abca269aec1409ec1e57de4c6cb5ba1da6369.tar.xz |
Refactor code to use new signoff model
This moves signoff creation and display to the new packages.Signoff
model.
Signed-off-by: Dan McGee <dan@archlinux.org>
Diffstat (limited to 'main')
-rw-r--r-- | main/models.py | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/main/models.py b/main/models.py index 2f54908..473144d 100644 --- a/main/models.py +++ b/main/models.py @@ -6,6 +6,7 @@ from django.forms import ValidationError from main.utils import cache_function, make_choice from packages.models import PackageRelation +from packages.models import Signoff as PackageSignoff from datetime import datetime from itertools import groupby @@ -206,16 +207,13 @@ class Package(models.Model): @property def signoffs(self): - if 'signoffs_cache' in dir(self): - return self.signoffs_cache - self.signoffs_cache = list(Signoff.objects.filter( - pkg=self, - pkgver=self.pkgver, - pkgrel=self.pkgrel)) - return self.signoffs_cache + return PackageSignoff.objects.select_related('user').filter( + pkgbase=self.pkgbase, pkgver=self.pkgver, pkgrel=self.pkgrel, + epoch=self.epoch, arch=self.arch, repo=self.repo) def approved_for_signoff(self): - return len(self.signoffs) >= 2 + count = self.signoffs.filter(revoked__isnull=True).count() + return count >= PackageSignoff.REQUIRED @cache_function(300) def applicable_arches(self): |