diff options
author | Étienne Loks <etienne.loks@iggdrasil.net> | 2022-07-07 11:31:19 +0200 |
---|---|---|
committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2022-07-08 09:59:31 +0200 |
commit | bb04eed6826f0f3cbe44fc56818fa31148c90f13 (patch) | |
tree | 1b5645a807777e15ed588713695b6402ab227225 | |
parent | 3c8cf538438abbf9d9b9951ae4112f404f5c6bbd (diff) | |
download | Ishtar-bb04eed6826f0f3cbe44fc56818fa31148c90f13.tar.bz2 Ishtar-bb04eed6826f0f3cbe44fc56818fa31148c90f13.zip |
Preventive file form: improve price agreement form (+ edit button, redirect)
3 files changed, 25 insertions, 1 deletions
diff --git a/archaeological_files/templates/ishtar/forms/preventive_detail.html b/archaeological_files/templates/ishtar/forms/preventive_detail.html index 9ad5c4802..59ebb8278 100644 --- a/archaeological_files/templates/ishtar/forms/preventive_detail.html +++ b/archaeological_files/templates/ishtar/forms/preventive_detail.html @@ -1,6 +1,16 @@ {% extends "ishtar/forms/base_form.html" %} {% load i18n table_form %} +{% block form_head %} +<div class="text-right"> + <a class="btn btn-success mb-3" href="{% url 'file-edit-preventive-price' file.pk %}"> + <i class="fa fa-pencil" aria-hidden="true"></i> + {% trans "Change price agreement" %} + </a> +</div> + +{% endblock %} + {% block bs_form_inlines %} <div class="card"> <div class="card-body"> diff --git a/archaeological_files/templates/ishtar/forms/preventive_price_agreement.html b/archaeological_files/templates/ishtar/forms/preventive_price_agreement.html new file mode 100644 index 000000000..d5d8a9319 --- /dev/null +++ b/archaeological_files/templates/ishtar/forms/preventive_price_agreement.html @@ -0,0 +1,10 @@ +{% extends "ishtar/forms/base_form.html" %} +{% load i18n %} + +{% block extra_validation_button %} +<div class="col-sm"> + <a href="{% url 'display-item' 'file' file.pk %}" class="btn btn-secondary" role="button" aria-pressed="true"> + {% trans "Back to the file" %} + </a> +</div> +{% endblock %} diff --git a/archaeological_files/views.py b/archaeological_files/views.py index 3e8d37809..d91688ac4 100644 --- a/archaeological_files/views.py +++ b/archaeological_files/views.py @@ -410,7 +410,7 @@ class PreventiveSimpleEditView(IshtarMixin, LoginRequiredMixin, UpdateView): page_name = _("Intervention plan") form_class = forms.PreventiveFileSimpleForm - template_name = "ishtar/forms/base_form.html" + template_name = "ishtar/forms/preventive_price_agreement.html" model = models.File def get_context_data(self, **kwargs): @@ -436,6 +436,10 @@ class PreventiveSimpleEditView(IshtarMixin, LoginRequiredMixin, item.delete() return super().form_valid(form) + def get_success_url(self): + url = reverse("file-edit-preventive", args=[self.object.pk]) + return url + class PreventiveEditView(IshtarMixin, LoginRequiredMixin, MixFormFormsetUpdateView): page_name = _("Intervention plan") |