summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJelle van der Waa <jelle@vdwaa.nl>2019-04-21 16:53:42 +0200
committerJelle van der Waa <jelle@vdwaa.nl>2019-04-21 16:53:42 +0200
commit4a71835d07a716d6f910a2e652072af9e25bdfc9 (patch)
treeab49448ed5aadb4842771927bd694888e8fe0b0c
parente1f9936c2bbbaeccf7baaacbd5c9e8343a8d565f (diff)
downloadarchweb-4a71835d07a716d6f910a2e652072af9e25bdfc9.tar.gz
archweb-4a71835d07a716d6f910a2e652072af9e25bdfc9.zip
main: Handle multiple testing repositories
Since there are multiple [testing] repositories when a package is in kde-unstable, testing and flagged in extra the in_testing function will generate an error since there are multiple results. Rewrite the query so it handles multiple results and order it by id since [testing] should have a lower id then kde-unstable.
-rw-r--r--main/models.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/main/models.py b/main/models.py
index e23a47a8..c033a079 100644
--- a/main/models.py
+++ b/main/models.py
@@ -397,8 +397,9 @@ class Package(models.Model):
if self.repo.testing:
return None
try:
- return Package.objects.normal().get(repo__testing=True,
- pkgname=self.pkgname, arch=self.arch)
+ # Kde-unstable is also a [testing] repo so sort on id.
+ return Package.objects.filter(repo__testing=True,
+ pkgname=self.pkgname, arch=self.arch).order_by('-id').first()
except Package.DoesNotExist:
return None