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:
48
intervention/managers.py
Normal file
48
intervention/managers.py
Normal file
@@ -0,0 +1,48 @@
|
||||
"""
|
||||
Author: Michel Peltriaux
|
||||
Organization: Struktur- und Genehmigungsdirektion Nord, Rhineland-Palatinate, Germany
|
||||
Contact: michel.peltriaux@sgdnord.rlp.de
|
||||
Created on: 14.10.21
|
||||
|
||||
"""
|
||||
from django.db import models
|
||||
|
||||
|
||||
class InterventionManager(models.Manager):
|
||||
""" Holds default db fetch setting for this model type
|
||||
|
||||
"""
|
||||
def get_queryset(self):
|
||||
return super().get_queryset().select_related(
|
||||
"recorded",
|
||||
"recorded__user",
|
||||
"modified",
|
||||
"modified__user",
|
||||
"checked",
|
||||
"checked__user",
|
||||
).prefetch_related(
|
||||
"users",
|
||||
)
|
||||
|
||||
|
||||
class LegalDataManager(models.Manager):
|
||||
""" Holds default db fetch setting for this model type
|
||||
|
||||
"""
|
||||
def get_queryset(self):
|
||||
return super().get_querset().select_related(
|
||||
"process_type",
|
||||
).prefetch_related(
|
||||
"laws"
|
||||
)
|
||||
|
||||
|
||||
class ResponsibilityDataManager(models.Manager):
|
||||
""" Holds default db fetch setting for this model type
|
||||
|
||||
"""
|
||||
def get_queryset(self):
|
||||
return super().get_querset().select_related(
|
||||
"registration_office",
|
||||
"conservation_office",
|
||||
)
|
||||
Reference in New Issue
Block a user