chrono/chrono/manager/templates/chrono/manager_events_type_form.html

58 lines
1.7 KiB
HTML

{% extends "chrono/manager_events_type_list.html" %}
{% load i18n %}
{% block breadcrumb %}
{{ block.super }}
{% if object.pk %}
<a href="{% url 'chrono-manager-events-type-edit' pk=object.pk %}">{{ object.label }}</a>
{% else %}
<a href="{% url 'chrono-manager-events-type-add' %}">{% trans "New events type" %}</a>
{% endif %}
{% endblock %}
{% block appbar %}
{% if object.pk %}
<h2>{% trans "Edit events type" %}</h2>
{% else %}
<h2>{% trans "New events type" %}</h2>
{% endif %}
{% endblock %}
{% block content %}
<form method="post" enctype="multipart/form-data">
{% csrf_token %}
{{ form.as_p }}
{% if object.pk %}
<h3>{% trans "Custom fields" %}</h3>
{{ formset.management_form }}
<table id="custom-field-forms">
<thead>
<tr>
{% for field in formset.0 %}
<th class="column-{{ field.name }}{% if field.required %} required{% endif %}">{{ field.label }}</th>
{% endfor %}
</tr>
</thead>
<tbody>
{% for sub_form in formset %}
<tr class='custom-field-form'>
{% for field in sub_form %}
<td class="field-{{ field.name }}">
{{ field.errors.as_ul }}
{{ field }}
</td>
{% endfor %}
</tr>
{% endfor %}
</tbody>
</table>
<button id="add-custom-field-form" type="button">{% trans "Add another custom field" %}</button>
{% endif %}
<div class="buttons">
<button class="submit-button">{% trans "Save" %}</button>
<a class="cancel" href="{% url 'chrono-manager-events-type-list' %}">{% trans 'Cancel' %}</a>
</div>
</form>
{% endblock %}