Add some select_related() magic
Made obvious when poking around with the Django debug toolbar. Signed-off-by: Dan McGee <dan@archlinux.org>
This commit is contained in:
parent
0e58a2e49f
commit
11f0db759b
@ -104,7 +104,7 @@ def get_differences_info(arch_a, arch_b):
|
||||
# column A will always have a value, column B might be NULL
|
||||
to_fetch.append(row[0])
|
||||
# fetch all of the necessary packages
|
||||
pkgs = Package.objects.in_bulk(to_fetch)
|
||||
pkgs = Package.objects.select_related('arch', 'repo').in_bulk(to_fetch)
|
||||
# now build a list of tuples containing differences
|
||||
differences = []
|
||||
for row in results:
|
||||
|
@ -43,7 +43,7 @@ def donate(request):
|
||||
return direct_to_template(request, 'public/donate.html', context)
|
||||
|
||||
def download(request):
|
||||
qset = MirrorUrl.objects.filter(
|
||||
qset = MirrorUrl.objects.select_related('mirror', 'protocol').filter(
|
||||
Q(protocol__protocol__iexact='HTTP') | Q(protocol__protocol__iexact='FTP'),
|
||||
mirror__public=True, mirror__active=True, mirror__isos=True
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user