EMA Filter
* refactors EmaTableFilter to inherit from EcoAccountFilter * refactors messages for recording/unrecording of EMA * adds/updates translations
This commit is contained in:
parent
77c59f9f7b
commit
c94d73c037
@ -7,47 +7,12 @@ Created on: 19.08.21
|
||||
"""
|
||||
from django.db.models import QuerySet
|
||||
|
||||
from compensation.filters import CompensationTableFilter
|
||||
from compensation.filters import EcoAccountTableFilter
|
||||
|
||||
|
||||
class EmaTableFilter(CompensationTableFilter):
|
||||
class EmaTableFilter(EcoAccountTableFilter):
|
||||
"""
|
||||
Since EMA and compensation are basically the same, we can reuse CompensationTableFilter and extend the MAE filter
|
||||
in the future by inheriting.
|
||||
"""
|
||||
|
||||
def _filter_show_all(self, queryset, name, value) -> QuerySet:
|
||||
""" Filters queryset depending on value of 'show_all' setting
|
||||
|
||||
Args:
|
||||
queryset ():
|
||||
name ():
|
||||
value ():
|
||||
|
||||
Returns:
|
||||
|
||||
"""
|
||||
if not value:
|
||||
return queryset.filter(
|
||||
users__in=[self.user], # requesting user has access
|
||||
)
|
||||
else:
|
||||
return queryset
|
||||
|
||||
def _filter_show_recorded(self, queryset, name, value) -> QuerySet:
|
||||
""" Filters queryset depending on value of 'show_recorded' setting
|
||||
|
||||
Args:
|
||||
queryset ():
|
||||
name ():
|
||||
value ():
|
||||
|
||||
Returns:
|
||||
|
||||
"""
|
||||
if not value:
|
||||
return queryset.filter(
|
||||
recorded=None,
|
||||
)
|
||||
else:
|
||||
return queryset
|
||||
pass
|
@ -167,10 +167,11 @@ def record_view(request: HttpRequest, id: str):
|
||||
|
||||
"""
|
||||
ema = get_object_or_404(Ema, id=id)
|
||||
msg_succ = _("{} unrecorded") if ema.recorded else _("{} recorded")
|
||||
form = RecordForm(request.POST or None, instance=ema, user=request.user)
|
||||
return form.process_request(
|
||||
request=request,
|
||||
msg_success=_("EMA recorded"),
|
||||
msg_success=msg_succ.format("EMA"),
|
||||
)
|
||||
|
||||
|
||||
|
Binary file not shown.
@ -16,7 +16,7 @@ msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: PACKAGE VERSION\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2021-08-19 14:01+0200\n"
|
||||
"POT-Creation-Date: 2021-08-19 14:33+0200\n"
|
||||
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||
@ -656,23 +656,23 @@ msgid "Compensation removed"
|
||||
msgstr "Kompensation entfernt"
|
||||
|
||||
#: compensation/views/compensation_views.py:162
|
||||
#: compensation/views/eco_account_views.py:283 ema/views.py:248
|
||||
#: compensation/views/eco_account_views.py:283 ema/views.py:249
|
||||
#: intervention/views.py:93
|
||||
msgid "Document added"
|
||||
msgstr "Dokument hinzugefügt"
|
||||
|
||||
#: compensation/views/compensation_views.py:181
|
||||
#: compensation/views/eco_account_views.py:227 ema/views.py:192
|
||||
#: compensation/views/eco_account_views.py:227 ema/views.py:193
|
||||
msgid "State added"
|
||||
msgstr "Zustand hinzugefügt"
|
||||
|
||||
#: compensation/views/compensation_views.py:200
|
||||
#: compensation/views/eco_account_views.py:246 ema/views.py:211
|
||||
#: compensation/views/eco_account_views.py:246 ema/views.py:212
|
||||
msgid "Action added"
|
||||
msgstr "Maßnahme hinzugefügt"
|
||||
|
||||
#: compensation/views/compensation_views.py:219
|
||||
#: compensation/views/eco_account_views.py:265 ema/views.py:230
|
||||
#: compensation/views/eco_account_views.py:265 ema/views.py:231
|
||||
msgid "Deadline added"
|
||||
msgstr "Frist/Termin hinzugefügt"
|
||||
|
||||
@ -692,11 +692,13 @@ msgstr "Ökokonto entfernt"
|
||||
msgid "Withdraw removed"
|
||||
msgstr "Abbuchung entfernt"
|
||||
|
||||
#: compensation/views/eco_account_views.py:204 intervention/views.py:376
|
||||
#: compensation/views/eco_account_views.py:204 ema/views.py:170
|
||||
#: intervention/views.py:376
|
||||
msgid "{} unrecorded"
|
||||
msgstr "{} entzeichnet"
|
||||
|
||||
#: compensation/views/eco_account_views.py:204 intervention/views.py:376
|
||||
#: compensation/views/eco_account_views.py:204 ema/views.py:170
|
||||
#: intervention/views.py:376
|
||||
msgid "{} recorded"
|
||||
msgstr "{} verzeichnet"
|
||||
|
||||
@ -733,16 +735,8 @@ msgid "Payment funded compensation"
|
||||
msgstr "Ersatzzahlungsmaßnahme"
|
||||
|
||||
#: ema/views.py:153
|
||||
#, fuzzy
|
||||
#| msgid "{} removed"
|
||||
msgid "EMA removed"
|
||||
msgstr "{} entfernt"
|
||||
|
||||
#: ema/views.py:173
|
||||
#, fuzzy
|
||||
#| msgid "{} recorded"
|
||||
msgid "EMA recorded"
|
||||
msgstr "{} verzeichnet"
|
||||
msgstr "EMA entfernt"
|
||||
|
||||
#: intervention/filters.py:25
|
||||
msgid "Show unshared"
|
||||
@ -909,6 +903,7 @@ msgid ""
|
||||
"Eco-account {} is not recorded yet. You can only withdraw from recorded "
|
||||
"accounts."
|
||||
msgstr ""
|
||||
"Ökokonto {} ist noch nicht verzeichnet. Abbuchungen können nur von verzeichneten Ökokonten erfolgen."
|
||||
|
||||
#: intervention/forms.py:544
|
||||
msgid ""
|
||||
@ -1248,11 +1243,11 @@ msgstr "{} geprüft"
|
||||
|
||||
#: konova/utils/messenger.py:71
|
||||
msgid "<a href=\"{}\">Check it out</a>"
|
||||
msgstr ""
|
||||
msgstr "<a href=\"{}\">Schauen Sie rein</a>"
|
||||
|
||||
#: konova/utils/messenger.py:72
|
||||
msgid "{} has been checked successfully by user {}! {}"
|
||||
msgstr ""
|
||||
msgstr "{} wurde erfolgreich vom Nutzer {} geprüft! {}"
|
||||
|
||||
#: konova/views.py:138
|
||||
msgid "Document '{}' deleted"
|
||||
@ -2670,6 +2665,9 @@ msgstr ""
|
||||
msgid "A fontawesome icon field"
|
||||
msgstr ""
|
||||
|
||||
#~ msgid "EMA recorded"
|
||||
#~ msgstr "EMA verzeichnet"
|
||||
|
||||
#~ msgid "Edit {}"
|
||||
#~ msgstr "Bearbeite {}"
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user