* refactors/renames folders and files for generic template rendering
* removes unused choiceColumnForm.html
This commit is contained in:
mipel
2021-10-06 16:15:40 +02:00
parent cac223c922
commit 86ed11c907
18 changed files with 26 additions and 31 deletions

View File

@@ -0,0 +1,36 @@
{% load i18n %}
{% block head %}
{{ form.media }}
{% endblock %}
{% block body %}
<div class="container">
<h4>
{{ form.form_title }}
</h4>
{% if form.form_caption is not None %}
<small>
{{ form.form_caption }}
</small>
{% endif %}
<form method="post" action="{{ form.action_url }}" {% for attr_key, attr_val in form.form_attrs.items %} {{attr_key}}="{{attr_val}}"{% endfor %}>
{% csrf_token %}
{% include 'form/table/generic_table_form_body.html' %}
<div class="row">
<div class="col-6">
<a href="{{ form.cancel_redirect }}">
<button class="btn btn-default" type="button" title="{% trans 'Cancel' %}">{% trans 'Cancel' %}</button>
</a>
</div>
<div class="col-6 d-flex justify-content-end">
<button class="btn btn-default" type="submit" title="{% trans 'Save' %}">{% trans 'Save' %}</button>
</div>
</div>
</form>
</div>
{% endblock %}
{% block footer %}
{{ form.media }}
{% endblock %}

View File

@@ -0,0 +1,26 @@
{% load i18n %}
<div class="table-responsive">
<table class="table">
<tbody>
{% for field in form %}
<tr title="{{ field.help_text }}" class="{% if field.errors %}alert-danger{% endif %}">
<th scope="row" class="col-sm-3">
<label for="id_{{ field.name }}">{{ field.label }}<span class="label-required">{% if field.field.required %}*{% endif %}</span></label>
<br>
<small>{{ field.help_text }}</small>
</th>
<td class="col-sm-9">
{{ field }}
{% for error in field.errors %}
<br>
<strong class="invalid">{{ error }}</strong>
{% endfor %}
</td>
</tr>
{% endfor %}
</tbody>
</table>
{% if form.has_required_fields %}
<small>{% trans 'Fields with * are required.' %}</small>
{% endif %}
</div>