HTML improvements

* refactors initializing and rendering of a map view into map/geom_form.html, which leads to simple includes on the detail views instead of redundant html
* refactors django-autocomplete-light form media links and scripts into dal/scripts.html, which can be included on the header blocks of detail views to support form modals using dal easier without the need for form.media
* changes filter behaviour on eco account index: instead of hiding recorded accounts (like in interventions), the filter option there has been replaced with "Show only unrecorded" which can be used to hide all recorded ones
   * background: eco accounts shall be visible when recorded, since they can only be used for withdrawing if they are recorded. Hiding the recorded ones does not make any sense, just like in interventions
* updates some code documentation
* adds/updates translations
This commit is contained in:
mipel
2021-08-10 13:12:15 +02:00
parent f8b3e5c8fd
commit 766d38bcbf
9 changed files with 131 additions and 87 deletions
+11 -2
View File
@@ -5,6 +5,9 @@ Contact: michel.peltriaux@sgdnord.rlp.de
Created on: 29.07.21
"""
import django_filters
from django.utils.translation import gettext_lazy as _
from django import forms
from django.db.models import QuerySet
from intervention.filters import InterventionTableFilter
@@ -62,6 +65,12 @@ class EcoAccountTableFilter(InterventionTableFilter):
Just some minor changes for EcoAccount model.
"""
sr = django_filters.BooleanFilter(
method='_filter_only_show_unrecorded',
label=_("Show only unrecorded"),
label_suffix=_(""),
widget=forms.CheckboxInput()
)
def _filter_show_all(self, queryset, name, value) -> QuerySet:
""" Filters queryset depending on value of 'show_all' setting
@@ -81,7 +90,7 @@ class EcoAccountTableFilter(InterventionTableFilter):
else:
return queryset
def _filter_show_recorded(self, queryset, name, value) -> QuerySet:
def _filter_only_show_unrecorded(self, queryset, name, value) -> QuerySet:
""" Filters queryset depending on value of 'show_recorded' setting
Args:
@@ -92,7 +101,7 @@ class EcoAccountTableFilter(InterventionTableFilter):
Returns:
"""
if not value:
if value:
return queryset.filter(
recorded=None,
)