29 lines
930 B
HTML
29 lines
930 B
HTML
<!-- Reusable Form Component -->
|
|
<form method="post" {% if form_action %}action="{{ form_action }}"{% endif %}
|
|
{% if form_enctype %}enctype="{{ form_enctype }}"{% endif %}>
|
|
{% csrf_token %}
|
|
|
|
{% if form.non_field_errors %}
|
|
<div class="alert alert-danger">
|
|
{{ form.non_field_errors }}
|
|
</div>
|
|
{% endif %}
|
|
|
|
{% for field in form %}
|
|
<div class="mb-3">
|
|
{{ field.label_tag }}
|
|
{{ field }}
|
|
{% if field.help_text %}
|
|
<div class="form-text">{{ field.help_text }}</div>
|
|
{% endif %}
|
|
{% if field.errors %}
|
|
<div class="text-danger">{{ field.errors }}</div>
|
|
{% endif %}
|
|
</div>
|
|
{% endfor %}
|
|
|
|
<div class="mb-3">
|
|
<button type="submit" class="btn btn-primary">{{ submit_button_text|default:"Submit" }}</button>
|
|
<a href="{{ cancel_url|default:"#" }}" class="btn btn-secondary">Cancel</a>
|
|
</div>
|
|
</form> |