summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorÉtienne Loks <etienne.loks@iggdrasil.net>2022-02-07 12:08:49 +0100
committerÉtienne Loks <etienne.loks@iggdrasil.net>2022-12-12 12:21:00 +0100
commita8c123dd20c310c8321d9bec0b76a03e4196b726 (patch)
tree25aa98f03a40cfc9cbf267f0cf2a8ecd12169b6f
parent641830616108b3f6e7210600a3b0a0f9f1a227a9 (diff)
downloadIshtar-a8c123dd20c310c8321d9bec0b76a03e4196b726.tar.bz2
Ishtar-a8c123dd20c310c8321d9bec0b76a03e4196b726.zip
Operation - Parcels - Modify: template - display table inline
-rw-r--r--archaeological_operations/templates/ishtar/forms/operation_modify_parcels.html25
-rw-r--r--ishtar_common/templates/blocks/inline_formset.html2
-rw-r--r--ishtar_common/templatetags/inline_formset.py2
3 files changed, 11 insertions, 18 deletions
diff --git a/archaeological_operations/templates/ishtar/forms/operation_modify_parcels.html b/archaeological_operations/templates/ishtar/forms/operation_modify_parcels.html
index 6128150be..117141e59 100644
--- a/archaeological_operations/templates/ishtar/forms/operation_modify_parcels.html
+++ b/archaeological_operations/templates/ishtar/forms/operation_modify_parcels.html
@@ -14,23 +14,16 @@
<div class="modal-body body-scroll">
<div class='form'>
{% block main_form %}
- {% if formset.non_form_errors %}
- <div class="alert alert-danger" role="alert">
- {{ formset.non_form_errors }}
- </div>
- {% endif %}
- <table>
- {% for form in formset %}
- {{form}}
- {% endfor %}
+ <table class='inline-table'>
+ <tr>
+ {% for field in formset.forms.0 %}
+ {% if field.name != 'pk' %}{% if field.required %}<th{%else%}<td{% endif %}{% if not forloop.last %} rowspan='2'{% endif %}>
+ {{ field.label_tag }}{% if field.required %}</th>{%else%}</td>{% endif %}{% endif %}{% endfor %}
+ </tr>
+ <tr><td>({% trans "all"%} <input type='checkbox' name='check-all' class='check-all'/>)</td></tr>
+ {% inline_formset 'Parcels' formset.forms False %}
+ </table>
- <tr>
- <td>
- ({% trans "all"%}
- <input type='checkbox' name='check-all' class='check-all'/>)
- </td>
- </tr>
- </table>
{% endblock %}
</div>
</div>
diff --git a/ishtar_common/templates/blocks/inline_formset.html b/ishtar_common/templates/blocks/inline_formset.html
index 9c1daad28..d6e76bc90 100644
--- a/ishtar_common/templates/blocks/inline_formset.html
+++ b/ishtar_common/templates/blocks/inline_formset.html
@@ -1,5 +1,5 @@
{% load i18n %}
- {% if extra_formset.non_form_errors %}<div class='errors'>{{extra_formset.non_form_errors.as_ul}}</div>{% endif %}
+ {% if formset.non_form_errors %}<div class='errors'>{{formset.non_form_errors.as_ul}}</div>{% endif %}
{% if header %}<table class='inline-table' id='{{formset.prefix}}'>
<caption>{% trans caption %}</caption>
<thead>
diff --git a/ishtar_common/templatetags/inline_formset.py b/ishtar_common/templatetags/inline_formset.py
index 9e3bfe9c9..2d225e448 100644
--- a/ishtar_common/templatetags/inline_formset.py
+++ b/ishtar_common/templatetags/inline_formset.py
@@ -10,7 +10,7 @@ register = template.Library()
def inline_formset(caption, formset, header=True, skip=False):
"""
Render a formset as an inline table.
- For i18n of the caption be carreful to add manualy the caption label to
+ For i18n of the caption be careful to add manually the caption label to
the translated fields
"""
return {'caption': caption, 'formset': formset, 'header': header,