From ac63cc4101da73e5b1b4424c53f29033557c6596 Mon Sep 17 00:00:00 2001 From: Dusty Phillips Date: Sat, 16 Aug 2008 13:36:15 -0400 Subject: #10340 Integrated Signoffs completed but untested --- main/models.py | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) (limited to 'main') diff --git a/main/models.py b/main/models.py index 7cd00bf..49df21e 100644 --- a/main/models.py +++ b/main/models.py @@ -225,6 +225,17 @@ class Package(models.Model): return '/packages/%s/%s/%s/' % (self.repo.name.lower(), self.arch.name, self.pkgname) + @property + def signoffs(self): + return Signoff.objects.filter( + pkg=self, + pkgver=self.pkgver, + pkgrel=self.pkgrel) + + def approved_for_signoff(self): + return self.signoffs.count() >= 2 + + def get_requiredby(self): """ Returns a list of package objects. @@ -270,12 +281,7 @@ class Signoff(models.Model): pkg = models.ForeignKey(Package) pkgver = models.CharField(maxlength=255) pkgrel = models.CharField(maxlength=255) - signed_off = models.ManyToManyField(User) - - def is_approved(self): - if signed_off.all().count() > 2: - return True - return False + packager = models.ForeignKey(User) class PackageFile(models.Model): id = models.AutoField(primary_key=True) -- cgit v1.2.3-24-g4f1b