# 70 Tab title compensation
* adds tab titles for compensations * adds/updates translations * optimizes identifier generating, so that one-digit months will be converted into two digits
This commit is contained in:
parent
dc42278943
commit
014155b0a4
@ -13,6 +13,7 @@ from intervention.models import Intervention
|
|||||||
from konova.contexts import BaseContext
|
from konova.contexts import BaseContext
|
||||||
from konova.decorators import *
|
from konova.decorators import *
|
||||||
from konova.forms import RemoveModalForm, SimpleGeomForm
|
from konova.forms import RemoveModalForm, SimpleGeomForm
|
||||||
|
from konova.sub_settings.context_settings import TAB_TITLE_IDENTIFIER
|
||||||
from konova.utils.documents import get_document, remove_document
|
from konova.utils.documents import get_document, remove_document
|
||||||
from konova.utils.generators import generate_qr_code
|
from konova.utils.generators import generate_qr_code
|
||||||
from konova.utils.message_templates import FORM_INVALID, IDENTIFIER_REPLACED, DATA_UNSHARED_EXPLANATION, \
|
from konova.utils.message_templates import FORM_INVALID, IDENTIFIER_REPLACED, DATA_UNSHARED_EXPLANATION, \
|
||||||
@ -43,6 +44,7 @@ def index_view(request: HttpRequest):
|
|||||||
)
|
)
|
||||||
context = {
|
context = {
|
||||||
"table": table,
|
"table": table,
|
||||||
|
TAB_TITLE_IDENTIFIER: _("Compensations - Overview"),
|
||||||
}
|
}
|
||||||
context = BaseContext(request, context).context
|
context = BaseContext(request, context).context
|
||||||
return render(request, template, context)
|
return render(request, template, context)
|
||||||
@ -86,6 +88,7 @@ def new_view(request: HttpRequest, intervention_id: str = None):
|
|||||||
context = {
|
context = {
|
||||||
"form": data_form,
|
"form": data_form,
|
||||||
"geom_form": geom_form,
|
"geom_form": geom_form,
|
||||||
|
TAB_TITLE_IDENTIFIER: _("New compensation"),
|
||||||
}
|
}
|
||||||
context = BaseContext(request, context).context
|
context = BaseContext(request, context).context
|
||||||
return render(request, template, context)
|
return render(request, template, context)
|
||||||
@ -150,6 +153,7 @@ def edit_view(request: HttpRequest, id: str):
|
|||||||
context = {
|
context = {
|
||||||
"form": data_form,
|
"form": data_form,
|
||||||
"geom_form": geom_form,
|
"geom_form": geom_form,
|
||||||
|
TAB_TITLE_IDENTIFIER: _("Edit {}").format(comp.identifier),
|
||||||
}
|
}
|
||||||
context = BaseContext(request, context).context
|
context = BaseContext(request, context).context
|
||||||
return render(request, template, context)
|
return render(request, template, context)
|
||||||
@ -202,6 +206,7 @@ def detail_view(request: HttpRequest, id: str):
|
|||||||
"is_zb_member": in_group(_user, ZB_GROUP),
|
"is_zb_member": in_group(_user, ZB_GROUP),
|
||||||
"is_ets_member": in_group(_user, ETS_GROUP),
|
"is_ets_member": in_group(_user, ETS_GROUP),
|
||||||
"LANIS_LINK": comp.get_LANIS_link(),
|
"LANIS_LINK": comp.get_LANIS_link(),
|
||||||
|
TAB_TITLE_IDENTIFIER: f"{comp.identifier} - {comp.title}",
|
||||||
}
|
}
|
||||||
context = BaseContext(request, context).context
|
context = BaseContext(request, context).context
|
||||||
return render(request, template, context)
|
return render(request, template, context)
|
||||||
@ -444,10 +449,15 @@ def report_view(request: HttpRequest, id: str):
|
|||||||
template = "compensation/report/compensation/report.html"
|
template = "compensation/report/compensation/report.html"
|
||||||
comp = get_object_or_404(Compensation, id=id)
|
comp = get_object_or_404(Compensation, id=id)
|
||||||
|
|
||||||
|
tab_title = _("Report {}").format(comp.identifier)
|
||||||
# If intervention is not recorded (yet or currently) we need to render another template without any data
|
# If intervention is not recorded (yet or currently) we need to render another template without any data
|
||||||
if not comp.intervention.recorded:
|
if not comp.intervention.recorded:
|
||||||
template = "report/unavailable.html"
|
template = "report/unavailable.html"
|
||||||
return render(request, template, {})
|
context = {
|
||||||
|
TAB_TITLE_IDENTIFIER: tab_title,
|
||||||
|
}
|
||||||
|
context = BaseContext(request, context).context
|
||||||
|
return render(request, template, context)
|
||||||
|
|
||||||
# Prepare data for map viewer
|
# Prepare data for map viewer
|
||||||
geom_form = SimpleGeomForm(
|
geom_form = SimpleGeomForm(
|
||||||
@ -477,6 +487,7 @@ def report_view(request: HttpRequest, id: str):
|
|||||||
"geom_form": geom_form,
|
"geom_form": geom_form,
|
||||||
"parcels": parcels,
|
"parcels": parcels,
|
||||||
"actions": actions,
|
"actions": actions,
|
||||||
|
TAB_TITLE_IDENTIFIER: tab_title,
|
||||||
}
|
}
|
||||||
context = BaseContext(request, context).context
|
context = BaseContext(request, context).context
|
||||||
return render(request, template, context)
|
return render(request, template, context)
|
||||||
|
@ -182,7 +182,12 @@ class BaseObject(BaseResource):
|
|||||||
return generate_random_string(10)
|
return generate_random_string(10)
|
||||||
|
|
||||||
_now = now()
|
_now = now()
|
||||||
curr_month = str(_now.month)
|
curr_month = _now.month
|
||||||
|
if curr_month < 10:
|
||||||
|
# Make sure month part has two digits to have same length identifiers by default
|
||||||
|
curr_month = f"0{curr_month}"
|
||||||
|
else:
|
||||||
|
curr_month = str(curr_month)
|
||||||
curr_year = str(_now.year)
|
curr_year = str(_now.year)
|
||||||
rand_str = generate_random_string(
|
rand_str = generate_random_string(
|
||||||
length=definitions[self.__class__]["length"],
|
length=definitions[self.__class__]["length"],
|
||||||
|
Binary file not shown.
@ -26,7 +26,7 @@ msgid ""
|
|||||||
msgstr ""
|
msgstr ""
|
||||||
"Project-Id-Version: PACKAGE VERSION\n"
|
"Project-Id-Version: PACKAGE VERSION\n"
|
||||||
"Report-Msgid-Bugs-To: \n"
|
"Report-Msgid-Bugs-To: \n"
|
||||||
"POT-Creation-Date: 2022-01-20 12:07+0100\n"
|
"POT-Creation-Date: 2022-01-20 12:17+0100\n"
|
||||||
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||||
@ -426,7 +426,7 @@ msgstr "kompensiert Eingriff"
|
|||||||
msgid "Select the intervention for which this compensation compensates"
|
msgid "Select the intervention for which this compensation compensates"
|
||||||
msgstr "Wählen Sie den Eingriff, für den diese Kompensation bestimmt ist"
|
msgstr "Wählen Sie den Eingriff, für den diese Kompensation bestimmt ist"
|
||||||
|
|
||||||
#: compensation/forms/forms.py:184
|
#: compensation/forms/forms.py:184 compensation/views/compensation.py:91
|
||||||
msgid "New compensation"
|
msgid "New compensation"
|
||||||
msgstr "Neue Kompensation"
|
msgstr "Neue Kompensation"
|
||||||
|
|
||||||
@ -1055,53 +1055,65 @@ msgstr ""
|
|||||||
msgid "Responsible data"
|
msgid "Responsible data"
|
||||||
msgstr "Daten zu den verantwortlichen Stellen"
|
msgstr "Daten zu den verantwortlichen Stellen"
|
||||||
|
|
||||||
#: compensation/views/compensation.py:79
|
#: compensation/views/compensation.py:47
|
||||||
|
msgid "Compensations - Overview"
|
||||||
|
msgstr "Kompensationen - Übersicht"
|
||||||
|
|
||||||
|
#: compensation/views/compensation.py:81
|
||||||
msgid "Compensation {} added"
|
msgid "Compensation {} added"
|
||||||
msgstr "Kompensation {} hinzugefügt"
|
msgstr "Kompensation {} hinzugefügt"
|
||||||
|
|
||||||
#: compensation/views/compensation.py:143
|
#: compensation/views/compensation.py:146
|
||||||
msgid "Compensation {} edited"
|
msgid "Compensation {} edited"
|
||||||
msgstr "Kompensation {} bearbeitet"
|
msgstr "Kompensation {} bearbeitet"
|
||||||
|
|
||||||
#: compensation/views/compensation.py:230 compensation/views/eco_account.py:309
|
#: compensation/views/compensation.py:156 intervention/views.py:309
|
||||||
|
msgid "Edit {}"
|
||||||
|
msgstr "Bearbeite {}"
|
||||||
|
|
||||||
|
#: compensation/views/compensation.py:235 compensation/views/eco_account.py:309
|
||||||
#: ema/views.py:183 intervention/views.py:482
|
#: ema/views.py:183 intervention/views.py:482
|
||||||
msgid "Log"
|
msgid "Log"
|
||||||
msgstr "Log"
|
msgstr "Log"
|
||||||
|
|
||||||
#: compensation/views/compensation.py:253
|
#: compensation/views/compensation.py:258
|
||||||
msgid "Compensation removed"
|
msgid "Compensation removed"
|
||||||
msgstr "Kompensation entfernt"
|
msgstr "Kompensation entfernt"
|
||||||
|
|
||||||
#: compensation/views/compensation.py:274 compensation/views/eco_account.py:461
|
#: compensation/views/compensation.py:279 compensation/views/eco_account.py:461
|
||||||
#: ema/views.py:350 intervention/views.py:132
|
#: ema/views.py:350 intervention/views.py:132
|
||||||
msgid "Document added"
|
msgid "Document added"
|
||||||
msgstr "Dokument hinzugefügt"
|
msgstr "Dokument hinzugefügt"
|
||||||
|
|
||||||
#: compensation/views/compensation.py:343 compensation/views/eco_account.py:355
|
#: compensation/views/compensation.py:348 compensation/views/eco_account.py:355
|
||||||
#: ema/views.py:288
|
#: ema/views.py:288
|
||||||
msgid "State added"
|
msgid "State added"
|
||||||
msgstr "Zustand hinzugefügt"
|
msgstr "Zustand hinzugefügt"
|
||||||
|
|
||||||
#: compensation/views/compensation.py:364 compensation/views/eco_account.py:376
|
#: compensation/views/compensation.py:369 compensation/views/eco_account.py:376
|
||||||
#: ema/views.py:309
|
#: ema/views.py:309
|
||||||
msgid "Action added"
|
msgid "Action added"
|
||||||
msgstr "Maßnahme hinzugefügt"
|
msgstr "Maßnahme hinzugefügt"
|
||||||
|
|
||||||
#: compensation/views/compensation.py:385 compensation/views/eco_account.py:441
|
#: compensation/views/compensation.py:390 compensation/views/eco_account.py:441
|
||||||
#: ema/views.py:330
|
#: ema/views.py:330
|
||||||
msgid "Deadline added"
|
msgid "Deadline added"
|
||||||
msgstr "Frist/Termin hinzugefügt"
|
msgstr "Frist/Termin hinzugefügt"
|
||||||
|
|
||||||
#: compensation/views/compensation.py:407 compensation/views/eco_account.py:398
|
#: compensation/views/compensation.py:412 compensation/views/eco_account.py:398
|
||||||
#: ema/views.py:420
|
#: ema/views.py:420
|
||||||
msgid "State removed"
|
msgid "State removed"
|
||||||
msgstr "Zustand gelöscht"
|
msgstr "Zustand gelöscht"
|
||||||
|
|
||||||
#: compensation/views/compensation.py:429 compensation/views/eco_account.py:420
|
#: compensation/views/compensation.py:434 compensation/views/eco_account.py:420
|
||||||
#: ema/views.py:442
|
#: ema/views.py:442
|
||||||
msgid "Action removed"
|
msgid "Action removed"
|
||||||
msgstr "Maßnahme entfernt"
|
msgstr "Maßnahme entfernt"
|
||||||
|
|
||||||
|
#: compensation/views/compensation.py:452 intervention/views.py:546
|
||||||
|
msgid "Report {}"
|
||||||
|
msgstr "Bericht {}"
|
||||||
|
|
||||||
#: compensation/views/eco_account.py:89
|
#: compensation/views/eco_account.py:89
|
||||||
msgid "Eco-Account {} added"
|
msgid "Eco-Account {} added"
|
||||||
msgstr "Ökokonto {} hinzugefügt"
|
msgstr "Ökokonto {} hinzugefügt"
|
||||||
@ -1475,10 +1487,6 @@ msgstr "Dem Eingriff liegen {} Widersprüche vor"
|
|||||||
msgid "Intervention {} edited"
|
msgid "Intervention {} edited"
|
||||||
msgstr "Eingriff {} bearbeitet"
|
msgstr "Eingriff {} bearbeitet"
|
||||||
|
|
||||||
#: intervention/views.py:309
|
|
||||||
msgid "Edit {}"
|
|
||||||
msgstr "Bearbeite {}"
|
|
||||||
|
|
||||||
#: intervention/views.py:333
|
#: intervention/views.py:333
|
||||||
msgid "{} removed"
|
msgid "{} removed"
|
||||||
msgstr "{} entfernt"
|
msgstr "{} entfernt"
|
||||||
@ -1499,10 +1507,6 @@ msgstr "Widerspruch hinzugefügt"
|
|||||||
msgid "There are errors on this intervention:"
|
msgid "There are errors on this intervention:"
|
||||||
msgstr "Es liegen Fehler in diesem Eingriff vor:"
|
msgstr "Es liegen Fehler in diesem Eingriff vor:"
|
||||||
|
|
||||||
#: intervention/views.py:546
|
|
||||||
msgid "Report {}"
|
|
||||||
msgstr "Bericht {}"
|
|
||||||
|
|
||||||
#: konova/decorators.py:30
|
#: konova/decorators.py:30
|
||||||
msgid "You need to be staff to perform this action!"
|
msgid "You need to be staff to perform this action!"
|
||||||
msgstr "Hierfür müssen Sie Mitarbeiter sein!"
|
msgstr "Hierfür müssen Sie Mitarbeiter sein!"
|
||||||
|
Loading…
Reference in New Issue
Block a user