summaryrefslogtreecommitdiffstats
path: root/main
diff options
context:
space:
mode:
authorDan McGee <dan@archlinux.org>2010-01-31 23:42:12 +0100
committerDan McGee <dan@archlinux.org>2010-01-31 23:42:12 +0100
commit382d36f4bfb5855bbe6154324229d1e2de447f62 (patch)
treea3b7b15a2b1d754aa42220089b26045e654712f8 /main
parentb1a5a6d968b5062abd72c8c87c3511e220aeaa35 (diff)
downloadarchweb-382d36f4bfb5855bbe6154324229d1e2de447f62.tar.gz
archweb-382d36f4bfb5855bbe6154324229d1e2de447f62.tar.xz
Make looking up a package with many required by entries faster
We were doing a 2 queries for each 'Required By' entry- arch and repo as usual. Add it to the original query so we don't waste time. Noticed while looking at the glibc description page. Signed-off-by: Dan McGee <dan@archlinux.org>
Diffstat (limited to 'main')
-rw-r--r--main/models.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/main/models.py b/main/models.py
index 8d5da3b..570221b 100644
--- a/main/models.py
+++ b/main/models.py
@@ -205,7 +205,7 @@ class Package(models.Model):
"""
Returns a list of package objects.
"""
- requiredby = Package.objects.filter(
+ requiredby = Package.objects.select_related('arch', 'repo').filter(
packagedepend__depname=self.pkgname,
arch__name__in=(self.arch.name, 'Any'))
return requiredby.order_by('pkgname')