diff options
author | Dan McGee <dan@archlinux.org> | 2010-07-07 01:53:03 +0200 |
---|---|---|
committer | Dan McGee <dan@archlinux.org> | 2010-07-07 01:53:03 +0200 |
commit | b6fb5e02e5c5868e76eecd93e7d742dcd0a57466 (patch) | |
tree | 2af37bfb6a5412e4ddd8bdbaaad4a29c4c277832 /main | |
parent | edfdc2e38bcab6a5efedfd789db24d86205c076a (diff) | |
download | archweb-b6fb5e02e5c5868e76eecd93e7d742dcd0a57466.tar.gz archweb-b6fb5e02e5c5868e76eecd93e7d742dcd0a57466.tar.xz |
Add helper method to package to find self in testing repo
This will be useful in templates getting touched in an upcoming commit.
Signed-off-by: Dan McGee <dan@archlinux.org>
Diffstat (limited to 'main')
-rw-r--r-- | main/models.py | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/main/models.py b/main/models.py index 8f1d9c9..088d406 100644 --- a/main/models.py +++ b/main/models.py @@ -321,6 +321,16 @@ class Package(models.Model): and self.pkgver == other.pkgver \ and self.pkgrel == other.pkgrel + def in_testing(self): + '''attempt to locate this package in a testing repo; if we are in + a testing repo we will always return None.''' + if self.repo.testing: + return None + try: + return Package.objects.get(repo__testing=True, + pkgname=self.pkgname, arch=self.arch) + except Package.DoesNotExist: + return None class Signoff(models.Model): pkg = models.ForeignKey(Package) |