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 fac6be0a8a
commit c209b2eb86
32 changed files with 364 additions and 122 deletions

View File

@@ -149,7 +149,7 @@ class BaseObject(BaseResource):
"""
if hasattr(self, "users"):
return self.users.filter(username=user.username).exists()
return self.users.filter(id=user.id)
else:
return User.objects.none()

View File

@@ -0,0 +1,28 @@
{% load i18n fontawesome_5 %}
{% comment %}
Used in e.g. reports and detail views for every model which supports comment field (BaseObject derived)
{% endcomment %}
{% if obj.comment %}
<div class="w-100">
<div class="card mt-3">
<div class="card-header rlp-gd">
<div class="row">
<div class="col-sm-12 col-md-12 col-lg-12">
<h5 class="card-title">
{% fa5_icon 'info-circle' %}
{% trans 'Comment' %}
</h5>
</div>
</div>
</div>
<div class="card-body">
<div class="card-text font-italic">
{{obj.comment}}
</div>
</div>
</div>
</div>
{% endif %}