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:
@@ -148,14 +148,13 @@ class CompensationTable(BaseTable):
|
||||
Returns:
|
||||
|
||||
"""
|
||||
html = ""
|
||||
if value is None:
|
||||
value = User.objects.none()
|
||||
has_access = value.filter(
|
||||
username=self.user.username
|
||||
id=self.user.id
|
||||
).exists()
|
||||
|
||||
html += self.render_icn(
|
||||
html = self.render_icn(
|
||||
tooltip=_("Full access granted") if has_access else _("Access not granted"),
|
||||
icn_class="fas fa-edit rlp-r-inv" if has_access else "far fa-edit",
|
||||
)
|
||||
@@ -244,7 +243,7 @@ class EcoAccountTable(BaseTable):
|
||||
return format_html(html)
|
||||
|
||||
def render_r(self, value, record: EcoAccount):
|
||||
""" Renders the registered column for an eco account
|
||||
""" Renders the recorded column for an eco account
|
||||
|
||||
Args:
|
||||
value (str): The identifier value
|
||||
@@ -268,7 +267,7 @@ class EcoAccountTable(BaseTable):
|
||||
return format_html(html)
|
||||
|
||||
def render_e(self, value, record: EcoAccount):
|
||||
""" Renders the registered column for an eco account
|
||||
""" Renders the editable column for an eco account
|
||||
|
||||
Args:
|
||||
value (str): The identifier value
|
||||
@@ -278,10 +277,9 @@ class EcoAccountTable(BaseTable):
|
||||
|
||||
"""
|
||||
html = ""
|
||||
has_access = value.filter(
|
||||
username=self.user.username
|
||||
).exists()
|
||||
|
||||
# Do not use value in here, since value does use unprefetched 'users' manager, where record has already
|
||||
# prefetched users data
|
||||
has_access = self.user in record.users.all()
|
||||
html += self.render_icn(
|
||||
tooltip=_("Full access granted") if has_access else _("Access not granted"),
|
||||
icn_class="fas fa-edit rlp-r-inv" if has_access else "far fa-edit",
|
||||
|
||||
Reference in New Issue
Block a user