summaryrefslogtreecommitdiff
path: root/main
diff options
context:
space:
mode:
authorDan McGee <dan@archlinux.org>2011-07-06 12:05:19 -0500
committerDan McGee <dan@archlinux.org>2011-07-06 12:12:17 -0500
commitf95abca269aec1409ec1e57de4c6cb5ba1da6369 (patch)
tree94a46c026a180790cb41c4ffce55fc330b807ce2 /main
parent4876a1258042a85d9c0a1d57a1a185f48850c929 (diff)
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.py14
1 files changed, 6 insertions, 8 deletions
diff --git a/main/models.py b/main/models.py
index 2f549081..473144da 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):