Login and registration #10
5 changed files with 23 additions and 4 deletions
|
@ -42,4 +42,4 @@
|
||||||
{% include "includes/form.html" %}
|
{% include "includes/form.html" %}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{% endblock content %}
|
{% endblock card_content %}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{% load i18n %}
|
{% load i18n %}
|
||||||
<div class="col-12">
|
<div class="col-12">
|
||||||
<div class="form-group{% with classes=field.css_classes %}{% if classes %} {{ classes }}{% endif %}{% endwith %}">
|
<div class="form-group{% with classes=field.css_classes %}{% if classes %} {{ classes }}{% endif %}{% endwith %}{% if errors %} is-invalid{% endif %}">
|
||||||
{% if field.field.widget.input_type != "checkbox" or field.field.widget.allow_multiple_selected %}
|
{% if field.field.widget.input_type != "checkbox" or field.field.widget.allow_multiple_selected %}
|
||||||
<label for="{{ field.auto_id }}" class="{{ label_class }}">
|
<label for="{{ field.auto_id }}" class="{{ label_class }}">
|
||||||
{{ field.label }}
|
{{ field.label }}
|
||||||
|
@ -17,7 +17,7 @@
|
||||||
<label for="{{ field.auto_id }}">{{ field.label }}</label>
|
<label for="{{ field.auto_id }}">{{ field.label }}</label>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if field.use_fieldset %}</fieldset>{% endif %}
|
{% if field.use_fieldset %}</fieldset>{% endif %}
|
||||||
{% for text in field.errors %}<div class="invalid-feedback">{{ text }}</div>{% endfor %}
|
{% for text in field.errors %}<div class="text-danger">{{ text }}</div>{% endfor %}
|
||||||
{% if field.help_text %}
|
{% if field.help_text %}
|
||||||
<small class="form-text text-muted"
|
<small class="form-text text-muted"
|
||||||
{% if field.auto_id %}id="{{ field.auto_id }}_helptext"{% endif %}>{{ field.help_text|safe }}</small>
|
{% if field.auto_id %}id="{{ field.auto_id }}_helptext"{% endif %}>{{ field.help_text|safe }}</small>
|
||||||
|
|
|
@ -34,4 +34,4 @@
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
{% endblock content %}
|
{% endblock card_content %}
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
<form class="form form-vertical"
|
<form class="form form-vertical"
|
||||||
method="post"
|
method="post"
|
||||||
{% if form_action %}action="{{ form_action }}"{% endif %}>
|
{% if form_action %}action="{{ form_action }}"{% endif %}>
|
||||||
|
{% include "includes/form_errors.html" %}
|
||||||
{% csrf_token %}
|
{% csrf_token %}
|
||||||
{{ form }}
|
{{ form }}
|
||||||
<button class="btn btn-primary" type="submit">
|
<button class="btn btn-primary" type="submit">
|
||||||
|
|
18
src/servala/frontend/templates/includes/form_errors.html
Normal file
18
src/servala/frontend/templates/includes/form_errors.html
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
{% load i18n %}
|
||||||
|
{% if form.non_field_errors or form.errors %}
|
||||||
|
<div class="alert alert-danger" role="alert">
|
||||||
|
<div>
|
||||||
|
{% if form.non_field_errors %}
|
||||||
|
{% if form.non_field_errors|length > 1 %}
|
||||||
|
<ul>
|
||||||
|
{% for error in form.non_field_errors %}<li>{{ error }}</li>{% endfor %}
|
||||||
|
</ul>
|
||||||
|
{% else %}
|
||||||
|
{{ form.non_field_errors.0 }}
|
||||||
|
{% endif %}
|
||||||
|
{% else %}
|
||||||
|
{% translate "We could not save your changes." %}
|
||||||
|
{% endif %}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
Loading…
Add table
Add a link
Reference in a new issue