From 6ef9750adef894a11001b959ba0f31def1f3fdd4 Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Wed, 28 Apr 2021 09:55:25 +0200 Subject: WIP: preventive forms --- .../templates/ishtar/forms/base_form.html | 50 +++++++++++++++++++++ ishtar_common/templates/ishtar/forms/document.html | 51 +++------------------- 2 files changed, 55 insertions(+), 46 deletions(-) create mode 100644 ishtar_common/templates/ishtar/forms/base_form.html (limited to 'ishtar_common/templates/ishtar') diff --git a/ishtar_common/templates/ishtar/forms/base_form.html b/ishtar_common/templates/ishtar/forms/base_form.html new file mode 100644 index 000000000..fb1fc997f --- /dev/null +++ b/ishtar_common/templates/ishtar/forms/base_form.html @@ -0,0 +1,50 @@ +{% extends "base.html" %} +{% load i18n inline_formset table_form from_dict %} +{% block extra_head %} +{{form.media}} +{% endblock %} + +{% block pre_container %} +
{% csrf_token %} +{% endblock %} +{% block content %} +

{{page_name}}

+
+ {% if form.non_field_errors or form.errors %} +
+
+ {% trans "Error on validation. Check all your fields. Modification not saved." %} +
+ {% for key, error_details in form.errors.items %} + {% with field=key|from_dict:form.fields %}{{ field.label }}{{error_details}}{% endwith %} + {% endfor %} +
+ {% endif %} + {% block form_head %} + {% endblock %} + {% bs_form form 0 True %} + {% for inline in inline_forms %} + {% bs_formset inline 0 True %} + {% endfor %} +
+{% endblock %} + +{% block footer %} + +
+{% endblock %} + diff --git a/ishtar_common/templates/ishtar/forms/document.html b/ishtar_common/templates/ishtar/forms/document.html index 8e2683a03..fe3df8c74 100644 --- a/ishtar_common/templates/ishtar/forms/document.html +++ b/ishtar_common/templates/ishtar/forms/document.html @@ -1,48 +1,7 @@ -{% extends "base.html" %} -{% load i18n inline_formset table_form from_dict %} -{% block extra_head %} -{{form.media}} -{% endblock %} - -{% block pre_container %} -
{% csrf_token %} -{% endblock %} -{% block content %} -

{{page_name}}

-
- {% if form.non_field_errors or form.errors %} -
-
- {% trans "Error on validation. Check all your fields. Modification not saved." %} -
- {% for key, error_details in form.errors.items %} - {% with field=key|from_dict:form.fields %}{{ field.label }}{{error_details}}{% endwith %} - {% endfor %} -
- {% endif %} - {% if item_related_label %}
+{% extends "ishtar/forms/base_form.html" %} +{% load i18n %} +{% block form_head %} +{% if item_related_label %}
{% trans "Related items" %}{% trans ":" %} {{ item_related_label }} -
{% endif %} - {% bs_form form 0 True %} -
-{% endblock %} - -{% block footer %} - - +
{% endif %} {% endblock %} - -- cgit v1.2.3