summaryrefslogtreecommitdiff
path: root/ishtar_common
diff options
context:
space:
mode:
authorÉtienne Loks <etienne.loks@proxience.com>2015-12-18 18:46:44 +0100
committerÉtienne Loks <etienne.loks@proxience.com>2015-12-18 18:46:44 +0100
commitf99cdf5c4c6931bd7315d2674b31ba2ee9e1c4ca (patch)
tree724c59996e20f35033254a453135fb7b1fd873d0 /ishtar_common
parent99004116cf0b45884bb3f52c62c1ae8bb5b36702 (diff)
downloadIshtar-f99cdf5c4c6931bd7315d2674b31ba2ee9e1c4ca.tar.bz2
Ishtar-f99cdf5c4c6931bd7315d2674b31ba2ee9e1c4ca.zip
Operation wizard: improve relations layout (form and summary)
Diffstat (limited to 'ishtar_common')
-rw-r--r--ishtar_common/templates/blocks/inline_formset.html2
-rw-r--r--ishtar_common/templates/ishtar/wizard/relations_wizard.html32
-rw-r--r--ishtar_common/templatetags/inline_formset.py7
3 files changed, 36 insertions, 5 deletions
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 %}<tr><td colspan='3'><ul>{% for error in frm.errors.values %}<li>{{error}}</li>{% endfor%}</ul></td></tr>{% endif %}
<tr>{% endif %}{% for field in frm.visible_fields %}<td>
{% if field.errors %}<div class='errors'>{{ field.errors.as_ul }}</div>{% 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 %}
+<form action="." method="post">{% csrf_token %}
+<div class='form'>
+{{ wizard.form.media }}
+{{ wizard.management_form }}
+{{ wizard.form.management_form }}
+
+{% if wizard.form.non_form_errors%}
+<table class='formset'>
+<tr class='error'><th colspan='2'>{{wizard.form.non_form_errors}}</th></tr>
+</table>{%endif%}
+
+<table class='inline-table'>
+ <tr>{% for field in wizard.form.forms.0 %}<th{% if not forloop.last %} rowspan='2'{% endif %}>{{ field.label_tag }}</th>{% endfor %}</tr>
+ <tr><td>({% trans "all"%} <input type='checkbox' name='check-all' class='check-all'/>)</td></tr>
+ {% inline_formset 'Parcels' wizard.form.forms False %}
+</table>
+<p><button name="formset_modify" value="{{wizard.steps.current}}">{% trans "Add/Modify" %}</button></p>
+<input type="hidden" name="{{ step_field }}" value="{{ step0 }}" />
+{{ previous_fields|safe }}
+{% block "validation_bar" %}
+{% include 'ishtar/wizard/validation_bar.html' %}
+{% endblock %}
+</div>
+</form>
+{% 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}