From ab191a5873011db4b44adf6d4e532681c29b4cb3 Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Fri, 18 Dec 2015 18:46:44 +0100 Subject: Operation wizard: improve relations layout (form and summary) --- ishtar_common/templates/blocks/inline_formset.html | 2 +- .../templates/ishtar/wizard/relations_wizard.html | 32 ++++++++++++++++++++++ ishtar_common/templatetags/inline_formset.py | 7 ++--- 3 files changed, 36 insertions(+), 5 deletions(-) create mode 100644 ishtar_common/templates/ishtar/wizard/relations_wizard.html (limited to 'ishtar_common') diff --git a/ishtar_common/templates/blocks/inline_formset.html b/ishtar_common/templates/blocks/inline_formset.html index 3affb7bf3..4d4042985 100644 --- a/ishtar_common/templates/blocks/inline_formset.html +++ b/ishtar_common/templates/blocks/inline_formset.html @@ -12,7 +12,7 @@ {% if frm.errors %}{% endif %} {% endif %}{% for field in frm.visible_fields %} {% if field.errors %}
{{ field.errors.as_ul }}
{% endif %} - {{ field }} + {{ field|safe }} {# Include the hidden fields in the form #} {% if forloop.first %} {{ formset.management_form }} diff --git a/ishtar_common/templates/ishtar/wizard/relations_wizard.html b/ishtar_common/templates/ishtar/wizard/relations_wizard.html new file mode 100644 index 000000000..9ca592ca8 --- /dev/null +++ b/ishtar_common/templates/ishtar/wizard/relations_wizard.html @@ -0,0 +1,32 @@ +{% extends "ishtar/wizard/default_wizard.html" %} +{% load i18n range inline_formset %} +{% block extra_head %} +{{wizard.form.media}} +{% endblock %} +{% block wizard_form %} +
{% csrf_token %} +
+{{ wizard.form.media }} +{{ wizard.management_form }} +{{ wizard.form.management_form }} + +{% if wizard.form.non_form_errors%} + + +
{{wizard.form.non_form_errors}}
{%endif%} + + + {% for field in wizard.form.forms.0 %}{{ field.label_tag }}{% endfor %} + + {% inline_formset 'Parcels' wizard.form.forms False %} +
({% trans "all"%} )
+

+ +{{ previous_fields|safe }} +{% block "validation_bar" %} +{% include 'ishtar/wizard/validation_bar.html' %} +{% endblock %} +
+
+{% endblock %} + diff --git a/ishtar_common/templatetags/inline_formset.py b/ishtar_common/templatetags/inline_formset.py index c3220f207..5e833c06f 100644 --- a/ishtar_common/templatetags/inline_formset.py +++ b/ishtar_common/templatetags/inline_formset.py @@ -2,11 +2,10 @@ # -*- coding: utf-8 -*- from django import template -from django.utils.translation import ugettext as _ -import re register = template.Library() + @register.inclusion_tag('blocks/inline_formset.html') def inline_formset(caption, formset, header=True, skip=False): u""" @@ -14,5 +13,5 @@ def inline_formset(caption, formset, header=True, skip=False): For i18n of the caption be carreful to add manualy the caption label to the translated fields """ - return {'caption':caption, 'formset':formset, 'header':header, 'skip':skip} - + return {'caption': caption, 'formset': formset, 'header': header, + 'skip': skip} -- cgit v1.2.3