mirror of
https://expo.survex.com/repositories/troggle/.git
synced 2024-11-22 07:11:52 +00:00
prefetch_related initial attempts
This commit is contained in:
parent
dbe6d10fff
commit
a11541eb58
@ -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 })
|
||||
|
@ -9,6 +9,10 @@
|
||||
plans and elevations. It also contains scans of centre-line survex output on which
|
||||
hand-drawn passage sections are drawn. These hand-drawn passages will eventually be
|
||||
traced to produce Tunnel or Therion drawings and eventually the final complete cave survey.
|
||||
|
||||
<!-- This should all be restructured to use .prefetch_related() and .select_related()
|
||||
see https://docs.djangoproject.com/en/3.2/ref/models/querysets/#prefetch-related
|
||||
-->
|
||||
<table width=95%>
|
||||
<tr><th>Scans folder</th><th>Files</th><th>Survex blocks</th><th>Cave</th></tr>
|
||||
{% for scanswallet in manywallets %}
|
||||
|
Loading…
Reference in New Issue
Block a user