summaryrefslogtreecommitdiff
path: root/main/models.py
diff options
context:
space:
mode:
authorDan McGee <dan@archlinux.org>2010-01-31 16:42:12 -0600
committerDan McGee <dan@archlinux.org>2010-01-31 16:42:12 -0600
commit382d36f4bfb5855bbe6154324229d1e2de447f62 (patch)
treea3b7b15a2b1d754aa42220089b26045e654712f8 /main/models.py
parentb1a5a6d968b5062abd72c8c87c3511e220aeaa35 (diff)
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/models.py')
-rw-r--r--main/models.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/main/models.py b/main/models.py
index 8d5da3bc..570221bf 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')