Database performance

* optimizes the db fetching for all index views and detail views
* introduces usage of managers.py in all necessary apps for wrapping basic fetch settings
* moves comment.html to comment_card.html under /konova/templates/konova/
* adds/updates translations
* fixes document typos
* drops comment rendering in public reports
* opens public reports in new tabs if button is clicked from the detail view
This commit is contained in:
2021-10-14 14:12:33 +02:00
parent f5f08b979b
commit 85759a636a
32 changed files with 364 additions and 122 deletions

View File

@@ -35,6 +35,8 @@ def index_view(request: HttpRequest):
# Filtering by user access is performed in table filter inside of InterventionTableFilter class
interventions = Intervention.objects.filter(
deleted=None, # not deleted
).select_related(
"legal"
)
table = InterventionTable(
request=request,
@@ -194,7 +196,14 @@ def detail_view(request: HttpRequest, id: str):
template = "intervention/detail/view.html"
# Fetch data, filter out deleted related data
intervention = get_object_or_404(Intervention, id=id)
intervention = get_object_or_404(
Intervention.objects.select_related(
"geometry",
"legal",
"responsible",
),
id=id
)
compensations = intervention.compensations.filter(
deleted=None,
)