Refactor group and music game models to use UniqueConstraint; update form error handling in templates

This commit is contained in:
Edgar P. Burkhart 2025-06-14 10:35:42 +02:00
parent 43ec6aafc4
commit 245a2503e2
Signed by: edpibu
GPG key ID: 9833D3C5A25BD227
5 changed files with 84 additions and 14 deletions

View file

@ -64,3 +64,9 @@ article.message {
color: var(--pico-color-red-500);
}
}
.form-error::before {
margin-right: .5em;
font-family: remixicon;
content: "\eca0";
}

View file

@ -1,8 +1,4 @@
{% if form.non_field_errors %}
<ul class="form-errors">
{% for error in form.non_field_errors %}<li>{{ error }}</li>{% endfor %}
</ul>
{% endif %}
{% for error in form.non_field_errors %}<article class="message error">{{ error }}</article>{% endfor %}
<form method="post" {% if action %}action="{% url action %}"{% endif %}>
{% csrf_token %}
<fieldset>
@ -10,12 +6,10 @@
<label>
{{ field.label }}
{{ field }}
{% if field.errors %}
<small id="{{ field.errors.field_id }}_error" class="form-error">{{ field.errors|join:", " }}</small>
{% endif %}
</label>
{% if field.errors %}
<ul class="form-errors">
{% for error in field.errors %}<li>{{ error }}</li>{% endfor %}
</ul>
{% endif %}
{% endfor %}
</fieldset>
<input type="submit" {% if submit %}value="{{ submit }}"{% endif %}>