2
0
mirror of https://expo.survex.com/repositories/troggle/.git synced 2025-12-15 07:47:13 +00:00

prefetch_related initial attempts

This commit is contained in:
Philip Sargent
2022-07-05 14:14:03 +03:00
parent dbe6d10fff
commit a11541eb58
2 changed files with 10 additions and 0 deletions

View File

@@ -58,5 +58,11 @@ def scansingle(request, path, file):
def allwallets(request):
'''Returns all the wallets in the system, we would like to use
the Django queryset SQL optimisation https://docs.djangoproject.com/en/3.2/ref/models/querysets/#prefetch-related
to get the related singlescan and survexblock objects but that requires rewriting this to do the query on those, not on
the wallets
'''
manywallets = Wallet.objects.all()
# manywallets = Wallet.objects.all().prefetch_related('singlescan') fails as the link is defined on 'singlescan' not on 'wallet'
return render(request, 'manywallets.html', { 'manywallets':manywallets, 'settings': settings })