Form rendering improvements
This commit is contained in:
parent
f17e1a0782
commit
6ed19e90a3
4 changed files with 17 additions and 10 deletions
|
@ -1,5 +1,10 @@
|
|||
{% load i18n %}
|
||||
<div class="form-group d-inline{% if field.field.required %} mandatory{% endif %}{% if errors %} is-invalid{% endif %}{% if extra_class %} {{ extra_class }}{% endif %}">
|
||||
<div class="form-group{% if field.field.required %} mandatory{% endif %}{% if errors %} is-invalid{% endif %}{% if extra_class %} {{ extra_class }}{% endif %}">
|
||||
{% if not hide_label %}
|
||||
{% if field.field.widget.input_type != "checkbox" or field.field.widget.allow_multiple_selected %}
|
||||
<label for="{{ field.auto_id }}" class="form-label">{{ field.label }}</label>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% if field.use_fieldset %}
|
||||
<fieldset {% if field.help_text and field.auto_id and "aria-describedby" not in field.field.widget.attrs %} aria-describedby="{{ field.auto_id }}_helptext"{% endif %}>
|
||||
{% endif %}
|
||||
|
|
|
@ -1 +1 @@
|
|||
{% include "frontend/forms/field.html" with extra_class="d-inline" %}
|
||||
{% include "frontend/forms/field.html" with extra_class="d-inline" hide_label=True %}
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
{% endpartialdef user-email %}
|
||||
{% partialdef user-company %}
|
||||
<td>
|
||||
{{ request.user.company|default_if_none:"" }}
|
||||
{{ request.user.company|default:"–" }}
|
||||
<button class="btn btn-primary"
|
||||
hx-get="{% url 'frontend:profile' %}?fragment=user-company-edit"
|
||||
hx-target="closest td"
|
||||
|
|
|
@ -5,11 +5,13 @@
|
|||
{% include "includes/form_errors.html" %}
|
||||
{% csrf_token %}
|
||||
{{ form }}
|
||||
<button class="btn btn-primary" type="submit">
|
||||
{% if form_submit_label %}
|
||||
{{ form_submit_label }}
|
||||
{% else %}
|
||||
{% translate "Save" %}
|
||||
{% endif %}
|
||||
</button>
|
||||
<div class="col-sm-12 d-flex justify-content-end">
|
||||
<button class="btn btn-primary me-1 mb-1" type="submit">
|
||||
{% if form_submit_label %}
|
||||
{{ form_submit_label }}
|
||||
{% else %}
|
||||
{% translate "Save" %}
|
||||
{% endif %}
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue