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:
@@ -17,6 +17,8 @@ from django.utils.translation import gettext_lazy as _
|
||||
from codelist.models import KonovaCode
|
||||
from codelist.settings import CODELIST_COMPENSATION_ACTION_ID, CODELIST_BIOTOPES_ID, \
|
||||
CODELIST_COMPENSATION_FUNDING_ID
|
||||
from compensation.managers import CompensationStateManager, EcoAccountDeductionManager, CompensationActionManager, \
|
||||
EcoAccountManager, CompensationManager
|
||||
from intervention.models import Intervention, ResponsibilityData
|
||||
from konova.models import BaseObject, BaseResource, Geometry, UuidModel, AbstractDocument, \
|
||||
generate_document_file_upload_path
|
||||
@@ -67,6 +69,8 @@ class CompensationState(UuidModel):
|
||||
)
|
||||
surface = models.FloatField()
|
||||
|
||||
objects = CompensationStateManager()
|
||||
|
||||
def __str__(self):
|
||||
return "{} | {} m²".format(self.biotope_type, self.surface)
|
||||
|
||||
@@ -102,6 +106,8 @@ class CompensationAction(BaseResource):
|
||||
unit = models.CharField(max_length=100, null=True, blank=True, choices=UnitChoices.choices)
|
||||
comment = models.TextField(blank=True, null=True, help_text="Additional comment")
|
||||
|
||||
objects = CompensationActionManager()
|
||||
|
||||
def __str__(self):
|
||||
return "{} | {} {}".format(self.action_type, self.amount, self.unit)
|
||||
|
||||
@@ -178,6 +184,8 @@ class Compensation(AbstractCompensation):
|
||||
related_name='compensations'
|
||||
)
|
||||
|
||||
objects = CompensationManager()
|
||||
|
||||
def __str__(self):
|
||||
return "{}".format(self.identifier)
|
||||
|
||||
@@ -301,6 +309,8 @@ class EcoAccount(AbstractCompensation):
|
||||
default=0,
|
||||
)
|
||||
|
||||
objects = EcoAccountManager()
|
||||
|
||||
def __str__(self):
|
||||
return "{}".format(self.identifier)
|
||||
|
||||
@@ -500,5 +510,7 @@ class EcoAccountDeduction(BaseResource):
|
||||
related_name="deductions",
|
||||
)
|
||||
|
||||
objects = EcoAccountDeductionManager()
|
||||
|
||||
def __str__(self):
|
||||
return "{} of {}".format(self.surface, self.account)
|
||||
|
||||
Reference in New Issue
Block a user