authentic/src/authentic2/manager/templates/authentic2/manager/form.html

96 lines
3.1 KiB
HTML

{% extends "authentic2/manager/base.html" %}
{% load i18n %}
{% block messages %}
{% if not request.is_ajax %}
{{ block.super }}
{% endif %}
{% endblock %}
{% block content %}
<form
{% if form.is_multipart %}enctype="multipart/form-data"{% endif %}
{% if form.form_id %}id="{{ form.form_id }}"{% endif %}
class="{{ form.css_class }}" method="post">
<div class="form-inner-container">
{% if messages %}
{% if request.is_ajax %}
<ul class="messages">
{% for message in messages %}
<li{% if message.tags %} class="{{ message.tags }}"{% endif %}>
{{ message }}
</li>
{% endfor %}
</ul>
{% endif %}
{% endif %}
{% csrf_token %}
{% block beforeform %}
{% endblock %}
{% if form.errors %}
<ul class="errorlist">
{% if not form.non_field_errors %}
<li>{% trans "The form contains some errors, please fix them." %}</li>
{% endif %}
{% for error in form.non_field_errors %}
<li>{{ error }}</li>
{% endfor %}
</ul>
{% endif %}
{% for field in form.visible_fields %}
{% block beforefield %}
{% endblock %}
<p id="{{field.id_for_label}}_p" class="{% if field.field.required %}required{% endif %} {% if field.errors %}error{% endif %}">
{{ field.label_tag }}
{{ field }}
{% if field.help_text %}
<span class="helptext">{{ field.help_text|safe }}</span>
{% endif %}
{% if field.errors %}
<ul class="errorlist">
{% for error in field.errors %}
<li>{{ error }}</li>
{% endfor %}
</ul>
{% endif %}
</p>
{% block afterfield %}
{% endblock %}
{% endfor %}
{% for field in form.hidden_fields %}
{{ field }}
{% endfor %}
{% block afterform %}
{% endblock %}
{% block buttons %}
<div class="buttons">
<a class="cancel" href="{% if cancel_url %}{{ cancel_url }}{% else %}..{% endif %}">{% trans "Cancel" %}</a>
<button>{% if action %}{{ action }}{% else %}{% trans "Save" %}{% endif %}</button>
</div>
{% endblock %}
</div>
<div class="other_actions">
{% block other_actions %}
{% if other_actions %}
<strong>{% trans "Actions" %}</strong>
{% for action in other_actions %}
<button name="{{ action.name }}"
{% if action.confirm %}data-confirm="{{ action.confirm }}"{% endif %}
{% if action.url_name %}data-url="{% url action.url_name pk=object.pk %}"{% endif %}
{% if action.url %}data-url="{{ action.url }}"{% endif %}
{% if action.popup %}rel="popup"{% endif %}
>{{ action.title }}</button>
{% endfor %}
{% endif %}
{% endblock %}
</div>
<script>
$(function () {
if ($.fn.djangoSelect2) {
$('.django-select2').djangoSelect2();
}
})
</script>
</form>
{% endblock %}