From efe26ae6f5b42fcedd40b516b0ea25a2e440f0bd Mon Sep 17 00:00:00 2001 From: mpeltriaux Date: Wed, 13 Oct 2021 09:26:46 +0200 Subject: [PATCH] Intervention template adjustments * renames intervention variable to obj to match other template style * renames open routes to detail routes --- compensation/account_urls.py | 2 +- compensation/comp_urls.py | 2 +- compensation/forms/forms.py | 6 +- compensation/tables.py | 4 +- .../detail/compensation/view.html | 2 +- .../eco_account/includes/deductions.html | 2 +- compensation/views/compensation_views.py | 6 +- compensation/views/eco_account_views.py | 6 +- ema/forms.py | 2 +- ema/tables.py | 2 +- ema/urls.py | 2 +- ema/views.py | 6 +- intervention/forms/forms.py | 2 +- intervention/tables.py | 2 +- .../intervention/detail/includes/comment.html | 4 +- .../detail/includes/compensations.html | 4 +- .../detail/includes/controls.html | 16 ++--- .../detail/includes/deductions.html | 8 +-- .../detail/includes/documents.html | 6 +- .../detail/includes/payments.html | 6 +- .../detail/includes/revocation.html | 10 ++-- .../templates/intervention/detail/view.html | 60 +++++++++---------- intervention/urls.py | 4 +- intervention/views.py | 10 ++-- 24 files changed, 87 insertions(+), 87 deletions(-) diff --git a/compensation/account_urls.py b/compensation/account_urls.py index 158e148a..47a178e2 100644 --- a/compensation/account_urls.py +++ b/compensation/account_urls.py @@ -12,7 +12,7 @@ urlpatterns = [ path("", index_view, name="acc-index"), path('new/', new_view, name='acc-new'), path('new/id', new_id_view, name='acc-new-id'), - path('', open_view, name='acc-open'), + path('', detail_view, name='acc-detail'), path('/log', log_view, name='acc-log'), path('/record', record_view, name='acc-record'), path('/edit', edit_view, name='acc-edit'), diff --git a/compensation/comp_urls.py b/compensation/comp_urls.py index 5ec578b3..cc025e86 100644 --- a/compensation/comp_urls.py +++ b/compensation/comp_urls.py @@ -14,7 +14,7 @@ urlpatterns = [ path('new/id', new_id_view, name='new-id'), path('new/', new_view, name='new'), path('new', new_view, name='new'), - path('', open_view, name='open'), + path('', detail_view, name='detail'), path('/log', log_view, name='log'), path('/edit', edit_view, name='edit'), path('/remove', remove_view, name='remove'), diff --git a/compensation/forms/forms.py b/compensation/forms/forms.py index 000cea2b..fd747ef5 100644 --- a/compensation/forms/forms.py +++ b/compensation/forms/forms.py @@ -179,7 +179,7 @@ class NewCompensationForm(AbstractCompensationForm): self.initialize_form_field("intervention", intervention_id) self.disable_form_field("intervention") self.action_url = reverse("compensation:new", args=(intervention_id,)) - self.cancel_redirect = reverse("intervention:open", args=(intervention_id,)) + self.cancel_redirect = reverse("intervention:detail", args=(intervention_id,)) else: self.action_url = reverse("compensation:new") self.cancel_redirect = reverse("compensation:index") @@ -230,7 +230,7 @@ class EditCompensationForm(NewCompensationForm): super().__init__(*args, **kwargs) self.form_title = _("Edit compensation") self.action_url = reverse("compensation:edit", args=(self.instance.id,)) - self.cancel_redirect = reverse("compensation:open", args=(self.instance.id,)) + self.cancel_redirect = reverse("compensation:detail", args=(self.instance.id,)) # Initialize form data form_data = { @@ -384,7 +384,7 @@ class EditEcoAccountForm(NewEcoAccountForm): self.form_title = _("Edit Eco-Account") self.action_url = reverse("compensation:acc-edit", args=(self.instance.id,)) - self.cancel_redirect = reverse("compensation:acc-open", args=(self.instance.id,)) + self.cancel_redirect = reverse("compensation:acc-detail", args=(self.instance.id,)) # Initialize form data form_data = { diff --git a/compensation/tables.py b/compensation/tables.py index 5f9f6e7c..278db13d 100644 --- a/compensation/tables.py +++ b/compensation/tables.py @@ -82,7 +82,7 @@ class CompensationTable(BaseTable): html = "" html += self.render_link( tooltip=_("Open {}").format(_("Compensation")), - href=reverse("compensation:open", args=(record.id,)), + href=reverse("compensation:detail", args=(record.id,)), txt=value, new_tab=False, ) @@ -223,7 +223,7 @@ class EcoAccountTable(BaseTable): html = "" html += self.render_link( tooltip=_("Open {}").format(_("Eco-account")), - href=reverse("compensation:acc-open", args=(record.id,)), + href=reverse("compensation:acc-detail", args=(record.id,)), txt=value, new_tab=False, ) diff --git a/compensation/templates/compensation/detail/compensation/view.html b/compensation/templates/compensation/detail/compensation/view.html index 487f2742..80b70613 100644 --- a/compensation/templates/compensation/detail/compensation/view.html +++ b/compensation/templates/compensation/detail/compensation/view.html @@ -33,7 +33,7 @@ {% trans 'compensates intervention' %} - + {{obj.intervention.identifier}} diff --git a/compensation/templates/compensation/detail/eco_account/includes/deductions.html b/compensation/templates/compensation/detail/eco_account/includes/deductions.html index 53061939..94d31da0 100644 --- a/compensation/templates/compensation/detail/eco_account/includes/deductions.html +++ b/compensation/templates/compensation/detail/eco_account/includes/deductions.html @@ -45,7 +45,7 @@ {% for deduction in deductions %} - + {{ deduction.intervention.identifier }} diff --git a/compensation/views/compensation_views.py b/compensation/views/compensation_views.py index 0d56d817..f4dc3921 100644 --- a/compensation/views/compensation_views.py +++ b/compensation/views/compensation_views.py @@ -74,7 +74,7 @@ def new_view(request: HttpRequest, intervention_id: str = None): ) ) messages.success(request, _("Compensation {} added").format(comp.identifier)) - return redirect("compensation:open", id=comp.id) + return redirect("compensation:detail", id=comp.id) else: messages.error(request, FORM_INVALID) else: @@ -129,7 +129,7 @@ def edit_view(request: HttpRequest, id: str): # The data form takes the geom form for processing, as well as the performing user comp = data_form.save(request.user, geom_form) messages.success(request, _("Compensation {} edited").format(comp.identifier)) - return redirect("compensation:open", id=comp.id) + return redirect("compensation:detail", id=comp.id) else: messages.error(request, FORM_INVALID) else: @@ -145,7 +145,7 @@ def edit_view(request: HttpRequest, id: str): @login_required @any_group_check -def open_view(request: HttpRequest, id: str): +def detail_view(request: HttpRequest, id: str): """ Renders a detail view for a compensation Args: diff --git a/compensation/views/eco_account_views.py b/compensation/views/eco_account_views.py index 476bd977..eab48da1 100644 --- a/compensation/views/eco_account_views.py +++ b/compensation/views/eco_account_views.py @@ -84,7 +84,7 @@ def new_view(request: HttpRequest): ) ) messages.success(request, _("Eco-Account {} added").format(acc.identifier)) - return redirect("compensation:acc-open", id=acc.id) + return redirect("compensation:acc-detail", id=acc.id) else: messages.error(request, FORM_INVALID) else: @@ -139,7 +139,7 @@ def edit_view(request: HttpRequest, id: str): # The data form takes the geom form for processing, as well as the performing user acc = data_form.save(request.user, geom_form) messages.success(request, _("Eco-Account {} edited").format(acc.identifier)) - return redirect("compensation:acc-open", id=acc.id) + return redirect("compensation:acc-detail", id=acc.id) else: messages.error(request, FORM_INVALID) else: @@ -155,7 +155,7 @@ def edit_view(request: HttpRequest, id: str): @login_required @any_group_check -def open_view(request: HttpRequest, id: str): +def detail_view(request: HttpRequest, id: str): """ Renders a detail view for a compensation Args: diff --git a/ema/forms.py b/ema/forms.py index d516259a..7fd42a51 100644 --- a/ema/forms.py +++ b/ema/forms.py @@ -99,7 +99,7 @@ class EditEmaForm(NewEmaForm): self.form_title = _("Edit EMA") self.action_url = reverse("ema:edit", args=(self.instance.id,)) - self.cancel_redirect = reverse("ema:open", args=(self.instance.id,)) + self.cancel_redirect = reverse("ema:detail", args=(self.instance.id,)) self.fields["identifier"].widget.attrs["url"] = reverse_lazy("ema:new-id") self.fields["title"].widget.attrs["placeholder"] = _("Compensation XY; Location ABC") diff --git a/ema/tables.py b/ema/tables.py index 5771307b..aeeece2f 100644 --- a/ema/tables.py +++ b/ema/tables.py @@ -80,7 +80,7 @@ class EmaTable(BaseTable): html = "" html += self.render_link( tooltip=_("Open {}").format(_("EMA")), - href=reverse("ema:open", args=(record.id,)), + href=reverse("ema:detail", args=(record.id,)), txt=value, new_tab=False, ) diff --git a/ema/urls.py b/ema/urls.py index 404cdf53..ac3bc1f8 100644 --- a/ema/urls.py +++ b/ema/urls.py @@ -13,7 +13,7 @@ urlpatterns = [ path("", index_view, name="index"), path("new/", new_view, name="new"), path("new/id", new_id_view, name="new-id"), - path("", open_view, name="open"), + path("", detail_view, name="detail"), path('/log', log_view, name='log'), path('/edit', edit_view, name='edit'), path('/remove', remove_view, name='remove'), diff --git a/ema/views.py b/ema/views.py index e479c17b..2d9a7f60 100644 --- a/ema/views.py +++ b/ema/views.py @@ -75,7 +75,7 @@ def new_view(request: HttpRequest): ) ) messages.success(request, _("EMA {} added").format(ema.identifier)) - return redirect("ema:open", id=ema.id) + return redirect("ema:detail", id=ema.id) else: messages.error(request, FORM_INVALID) else: @@ -108,7 +108,7 @@ def new_id_view(request: HttpRequest): @login_required -def open_view(request: HttpRequest, id: str): +def detail_view(request: HttpRequest, id: str): """ Renders the detail view of an EMA Args: @@ -199,7 +199,7 @@ def edit_view(request: HttpRequest, id: str): # The data form takes the geom form for processing, as well as the performing user ema = data_form.save(request.user, geom_form) messages.success(request, _("EMA {} edited").format(ema.identifier)) - return redirect("ema:open", id=ema.id) + return redirect("ema:detail", id=ema.id) else: messages.error(request, FORM_INVALID) else: diff --git a/intervention/forms/forms.py b/intervention/forms/forms.py index 27e2acf5..22364589 100644 --- a/intervention/forms/forms.py +++ b/intervention/forms/forms.py @@ -269,7 +269,7 @@ class EditInterventionForm(NewInterventionForm): super().__init__(*args, **kwargs) if self.instance is not None: self.action_url = reverse("intervention:edit", args=(self.instance.id,)) - self.cancel_redirect = reverse("intervention:open", args=(self.instance.id,)) + self.cancel_redirect = reverse("intervention:detail", args=(self.instance.id,)) self.form_title = _("Edit intervention") self.form_caption = "" diff --git a/intervention/tables.py b/intervention/tables.py index 1b9bc855..bf0e718d 100644 --- a/intervention/tables.py +++ b/intervention/tables.py @@ -86,7 +86,7 @@ class InterventionTable(BaseTable): html = "" html += self.render_link( tooltip=_("Open {}").format(_("Intervention")), - href=reverse("intervention:open", args=(record.id,)), + href=reverse("intervention:detail", args=(record.id,)), txt=value, new_tab=False, ) diff --git a/intervention/templates/intervention/detail/includes/comment.html b/intervention/templates/intervention/detail/includes/comment.html index 2f253568..aff3dec8 100644 --- a/intervention/templates/intervention/detail/includes/comment.html +++ b/intervention/templates/intervention/detail/includes/comment.html @@ -1,6 +1,6 @@ {% load i18n fontawesome_5 %} -{% if intervention.comment %} +{% if obj.comment %}
@@ -15,7 +15,7 @@
- {{intervention.comment}} + {{obj.comment}}
diff --git a/intervention/templates/intervention/detail/includes/compensations.html b/intervention/templates/intervention/detail/includes/compensations.html index 894c96af..c54c974f 100644 --- a/intervention/templates/intervention/detail/includes/compensations.html +++ b/intervention/templates/intervention/detail/includes/compensations.html @@ -11,7 +11,7 @@
{% if is_default_member and has_access %} - + {% if has_access %} - {% if is_zb_member %} - {% endif %} {% if is_ets_member %} - {% if intervention.recorded %} - {% else %} - {% endif %} {% endif %} {% if is_default_member %} - + - - {% endif %} diff --git a/intervention/templates/intervention/detail/includes/deductions.html b/intervention/templates/intervention/detail/includes/deductions.html index bfbfa367..be509998 100644 --- a/intervention/templates/intervention/detail/includes/deductions.html +++ b/intervention/templates/intervention/detail/includes/deductions.html @@ -4,14 +4,14 @@
- {{intervention.deductions.count}} + {{obj.deductions.count}} {% trans 'Eco Account Deductions' %}
{% if is_default_member and has_access %} - @@ -39,10 +39,10 @@ - {% for deduction in intervention.deductions.all %} + {% for deduction in obj.deductions.all %} - + {% if deduction.account.deleted or not deduction.account.recorded %} {% fa5_icon 'exclamation-triangle' %} {% endif %} diff --git a/intervention/templates/intervention/detail/includes/documents.html b/intervention/templates/intervention/detail/includes/documents.html index 54972bf5..1365edae 100644 --- a/intervention/templates/intervention/detail/includes/documents.html +++ b/intervention/templates/intervention/detail/includes/documents.html @@ -4,14 +4,14 @@
- {{intervention.documents.count}} + {{obj.documents.count}} {% trans 'Documents' %}
{% if is_default_member and has_access %} - @@ -36,7 +36,7 @@ - {% for doc in intervention.documents.all %} + {% for doc in obj.documents.all %} diff --git a/intervention/templates/intervention/detail/includes/payments.html b/intervention/templates/intervention/detail/includes/payments.html index 8177371a..b6b61d96 100644 --- a/intervention/templates/intervention/detail/includes/payments.html +++ b/intervention/templates/intervention/detail/includes/payments.html @@ -4,14 +4,14 @@
- {{intervention.payments.count}} + {{obj.payments.count}} {% trans 'Payments' %}
{% if is_default_member and has_access %} - @@ -39,7 +39,7 @@ - {% for pay in intervention.payments.all %} + {% for pay in obj.payments.all %} {{ pay.amount|floatformat:2 }} € diff --git a/intervention/templates/intervention/detail/includes/revocation.html b/intervention/templates/intervention/detail/includes/revocation.html index 10a4c44e..6699f016 100644 --- a/intervention/templates/intervention/detail/includes/revocation.html +++ b/intervention/templates/intervention/detail/includes/revocation.html @@ -4,7 +4,7 @@
- {% if intervention.legal.revocation %}1{% else %}0{% endif %} + {% if obj.legal.revocation %}1{% else %}0{% endif %} {% trans 'Revocation' %}
@@ -13,8 +13,8 @@ {% comment %} Only show add-button if no revocation exists, yet. {% endcomment %} - {% if is_default_member and has_access and not intervention.legal.revocation %} - @@ -42,8 +42,8 @@ - {% if intervention.legal.revocation %} - {% with intervention.legal.revocation as rev %} + {% if obj.legal.revocation %} + {% with obj.legal.revocation as rev %} {{ rev.date }} diff --git a/intervention/templates/intervention/detail/view.html b/intervention/templates/intervention/detail/view.html index 525182d5..7d2788e3 100644 --- a/intervention/templates/intervention/detail/view.html +++ b/intervention/templates/intervention/detail/view.html @@ -15,7 +15,7 @@
-

{% trans 'Intervention' %}
{{intervention.identifier}}

+

{% trans 'Intervention' %}
{{obj.identifier}}

{% include 'intervention/detail/includes/controls.html' %} @@ -26,52 +26,52 @@
- + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + diff --git a/intervention/urls.py b/intervention/urls.py index ac96d628..03c7c1d3 100644 --- a/intervention/urls.py +++ b/intervention/urls.py @@ -7,7 +7,7 @@ Created on: 30.11.20 """ from django.urls import path -from intervention.views import index_view, new_view, open_view, edit_view, remove_view, new_document_view, share_view, \ +from intervention.views import index_view, new_view, detail_view, edit_view, remove_view, new_document_view, share_view, \ create_share_view, remove_revocation_view, new_revocation_view, run_check_view, log_view, new_deduction_view, \ record_view, remove_document_view, get_document_view, get_revocation_view, new_id_view @@ -16,7 +16,7 @@ urlpatterns = [ path("", index_view, name="index"), path('new/', new_view, name='new'), path('new/id', new_id_view, name='new-id'), - path('', open_view, name='open'), + path('', detail_view, name='detail'), path('/log', log_view, name='log'), path('/edit', edit_view, name='edit'), path('/remove', remove_view, name='remove'), diff --git a/intervention/views.py b/intervention/views.py index 8c9679f1..a5c7e928 100644 --- a/intervention/views.py +++ b/intervention/views.py @@ -74,7 +74,7 @@ def new_view(request: HttpRequest): ) ) messages.success(request, _("Intervention {} added").format(intervention.identifier)) - return redirect("intervention:open", id=intervention.id) + return redirect("intervention:detail", id=intervention.id) else: messages.error(request, FORM_INVALID) else: @@ -180,7 +180,7 @@ def remove_document_view(request: HttpRequest, doc_id: str): @login_required @any_group_check -def open_view(request: HttpRequest, id: str): +def detail_view(request: HttpRequest, id: str): """ Renders a detail view for viewing an intervention's data Args: @@ -213,7 +213,7 @@ def open_view(request: HttpRequest, id: str): ) context = { - "intervention": intervention, + "obj": intervention, "compensations": compensations, "has_access": is_data_shared, "geom_form": geom_form, @@ -252,7 +252,7 @@ def edit_view(request: HttpRequest, id: str): # The data form takes the geom form for processing, as well as the performing user intervention = data_form.save(request.user, geom_form) messages.success(request, _("Intervention {} edited").format(intervention.identifier)) - return redirect("intervention:open", id=intervention.id) + return redirect("intervention:detail", id=intervention.id) else: messages.error(request, FORM_INVALID) else: @@ -338,7 +338,7 @@ def share_view(request: HttpRequest, id: str, token: str): _("{} has been shared with you").format(intervention.identifier) ) intervention.users.add(user) - return redirect("intervention:open", id=id) + return redirect("intervention:detail", id=id) else: messages.error( request,
{% trans 'Title' %}{{intervention.title|default_if_none:""}}{{obj.title|default_if_none:""}}
{% trans 'Process type' %}{{intervention.legal.process_type|default_if_none:""}}{{obj.legal.process_type|default_if_none:""}}
{% trans 'Law' %} - {% for law in intervention.legal.laws.all %} + {% for law in obj.legal.laws.all %}
{{law.short_name}} - {{law.long_name}}

{% endfor %}
{% trans 'Registration office' %}{{intervention.responsible.registration_office.str_as_office|default_if_none:""}}{{obj.responsible.registration_office.str_as_office|default_if_none:""}}
{% trans 'Registration office file number' %}{{intervention.responsible.registration_file_number|default_if_none:""}}{{obj.responsible.registration_file_number|default_if_none:""}}
{% trans 'Conservation office' %}{{intervention.responsible.conservation_office.str_as_office|default_if_none:""}}{{obj.responsible.conservation_office.str_as_office|default_if_none:""}}
{% trans 'Conservation office file number' %}{{intervention.responsible.conservation_file_number|default_if_none:""}}{{obj.responsible.conservation_file_number|default_if_none:""}}
{% trans 'Intervention handler' %}{{intervention.responsible.handler|default_if_none:""}}{{obj.responsible.handler|default_if_none:""}}
{% trans 'Checked' %} - {% if intervention.checked is None %} + {% if obj.checked is None %} {% fa5_icon 'star' 'far' %} {% else %} - + {% fa5_icon 'star' %} {% endif %} @@ -80,41 +80,41 @@
{% trans 'Recorded' %} - {% if intervention.recorded is None %} + {% if obj.recorded is None %} {% fa5_icon 'bookmark' 'far' %} {% else %} - + {% fa5_icon 'bookmark' %} {% endif %}
{% trans 'Registration date' %}{{intervention.legal.registration_date|default_if_none:""}}{{obj.legal.registration_date|default_if_none:""}}
{% trans 'Binding on' %}{{intervention.legal.binding_date|default_if_none:""}}{{obj.legal.binding_date|default_if_none:""}}
{% trans 'Revocation' %}{{intervention.legal.revocation.date|naturalday|default_if_none:""}}{{obj.legal.revocation.date|naturalday|default_if_none:""}}
{% trans 'Last modified' %} - {{intervention.created.timestamp|default_if_none:""|naturalday}} + {{obj.created.timestamp|default_if_none:""|naturalday}}
- {{intervention.created.user.username}} + {{obj.created.user.username}}
{% trans 'Shared with' %} - {% for user in intervention.users.all %} + {% for user in obj.users.all %} {% include 'user/includes/contact_modal_button.html' %} {% endfor %}