autocensup/templates/core/crud/form.html

54 lines
1.7 KiB
HTML

{% extends "base.html" %}
{% block title %}{{ action }} {{ config.title }} | Autocensup{% endblock %}
{% block page_pretitle %}Cadastros{% endblock %}
{% block page_title %}{{ action }} {{ config.title }}{% endblock %}
{% block page_actions %}
<a href="{% url 'crud_list' config.slug %}" class="btn">
<i class="ti ti-arrow-left me-2"></i>
Voltar
</a>
{% endblock %}
{% block content %}
<form method="post" class="card">
{% csrf_token %}
<div class="card-body">
{% if form.non_field_errors %}
<div class="alert alert-danger">
{{ form.non_field_errors }}
</div>
{% endif %}
<div class="row">
{% for field in form %}
<div class="col-md-6 col-xl-4 mb-3">
{% if field.field.widget.input_type == "checkbox" %}
<label class="form-check mt-4">
{{ field }}
<span class="form-check-label">{{ field.label }}</span>
</label>
{% else %}
<label class="form-label" for="{{ field.id_for_label }}">{{ field.label }}</label>
{{ field }}
{% endif %}
{% if field.help_text %}
<small class="form-hint">{{ field.help_text }}</small>
{% endif %}
{% for error in field.errors %}
<div class="invalid-feedback d-block">{{ error }}</div>
{% endfor %}
</div>
{% endfor %}
</div>
</div>
<div class="card-footer text-end">
<a href="{% url 'crud_list' config.slug %}" class="btn">Cancelar</a>
<button type="submit" class="btn btn-primary">
<i class="ti ti-device-floppy me-2"></i>
Salvar
</button>
</div>
</form>
{% endblock %}