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:
21
ema/managers.py
Normal file
21
ema/managers.py
Normal file
@@ -0,0 +1,21 @@
|
||||
"""
|
||||
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 EmaManager(models.Manager):
|
||||
""" Holds default db fetch setting for this model type
|
||||
|
||||
"""
|
||||
def get_queryset(self):
|
||||
return super().get_queryset().select_related(
|
||||
"modified",
|
||||
"modified__user",
|
||||
"recorded",
|
||||
"recorded__user",
|
||||
)
|
||||
@@ -5,6 +5,7 @@ from django.db import models
|
||||
from django.db.models import QuerySet
|
||||
|
||||
from compensation.models import AbstractCompensation
|
||||
from ema.managers import EmaManager
|
||||
from konova.models import AbstractDocument, generate_document_file_upload_path
|
||||
from konova.settings import DEFAULT_SRID_RLP, LANIS_LINK_TEMPLATE, EMA_DOC_PATH
|
||||
from user.models import UserActionLogEntry
|
||||
@@ -43,6 +44,8 @@ class Ema(AbstractCompensation):
|
||||
related_name="+"
|
||||
)
|
||||
|
||||
objects = EmaManager()
|
||||
|
||||
def __str__(self):
|
||||
return "{}".format(self.identifier)
|
||||
|
||||
|
||||
@@ -49,7 +49,7 @@ class EmaTable(BaseTable):
|
||||
lm = tables.Column(
|
||||
verbose_name=_("Last edit"),
|
||||
orderable=True,
|
||||
accessor="created__timestamp",
|
||||
accessor="modified__timestamp",
|
||||
)
|
||||
|
||||
class Meta(BaseTable.Meta):
|
||||
@@ -122,7 +122,7 @@ class EmaTable(BaseTable):
|
||||
"""
|
||||
html = ""
|
||||
has_access = value.filter(
|
||||
username=self.user.username
|
||||
id=self.user.id
|
||||
).exists()
|
||||
|
||||
html += self.render_icn(
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
LANIS
|
||||
</button>
|
||||
</a>
|
||||
<a href="{% url 'ema:report' obj.id %}" class="mr-2">
|
||||
<a href="{% url 'ema:report' obj.id %}" target="_blank" class="mr-2">
|
||||
<button class="btn btn-default" title="{% trans 'Public report' %}">
|
||||
{% fa5_icon 'file-alt' %}
|
||||
</button>
|
||||
|
||||
@@ -54,9 +54,6 @@
|
||||
<div class="row">
|
||||
{% include 'map/geom_form.html' %}
|
||||
</div>
|
||||
<div class="row">
|
||||
{% include 'intervention/detail/includes/comment.html' %}
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-sm-6 col-md-6 col-lg-6">
|
||||
<h4>{% trans 'Open in browser' %}</h4>
|
||||
|
||||
Reference in New Issue
Block a user