Intervention template adjustments
* renames intervention variable to obj to match other template style * renames open routes to detail routes
This commit is contained in:
@@ -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('<id>', open_view, name='acc-open'),
|
||||
path('<id>', detail_view, name='acc-detail'),
|
||||
path('<id>/log', log_view, name='acc-log'),
|
||||
path('<id>/record', record_view, name='acc-record'),
|
||||
path('<id>/edit', edit_view, name='acc-edit'),
|
||||
|
||||
@@ -14,7 +14,7 @@ urlpatterns = [
|
||||
path('new/id', new_id_view, name='new-id'),
|
||||
path('new/<intervention_id>', new_view, name='new'),
|
||||
path('new', new_view, name='new'),
|
||||
path('<id>', open_view, name='open'),
|
||||
path('<id>', detail_view, name='detail'),
|
||||
path('<id>/log', log_view, name='log'),
|
||||
path('<id>/edit', edit_view, name='edit'),
|
||||
path('<id>/remove', remove_view, name='remove'),
|
||||
|
||||
@@ -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 = {
|
||||
|
||||
@@ -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,
|
||||
)
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
<tr>
|
||||
<th scope="row">{% trans 'compensates intervention' %}</th>
|
||||
<td class="align-middle">
|
||||
<a href="{% url 'intervention:open' obj.intervention.id %}">
|
||||
<a href="{% url 'intervention:detail' obj.intervention.id %}">
|
||||
{{obj.intervention.identifier}}
|
||||
</a>
|
||||
</td>
|
||||
|
||||
@@ -45,7 +45,7 @@
|
||||
{% for deduction in deductions %}
|
||||
<tr>
|
||||
<td class="align-middle">
|
||||
<a href="{% url 'intervention:open' deduction.intervention.id %}">
|
||||
<a href="{% url 'intervention:detail' deduction.intervention.id %}">
|
||||
{{ deduction.intervention.identifier }}
|
||||
</a>
|
||||
</td>
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user