-
Notifications
You must be signed in to change notification settings - Fork 87
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update RadioSelectButtonGroup() with form validation and non-horizont…
…al alignment.
- Loading branch information
1 parent
fd36574
commit f935b50
Showing
2 changed files
with
19 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 19 additions & 15 deletions
34
src/django_bootstrap5/templates/django_bootstrap5/widgets/radio_select_button_group.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,20 @@ | ||
<div{% if widget.attrs.id %} id="{{ widget.attrs.id }}"{% endif %} class="btn-group" role="group"> | ||
{% for group, options, index in widget.optgroups %} | ||
{% for option in options %} | ||
<input type="{{ option.type }}" | ||
class="{{ widget.attrs.class|add:' btn-check' }}" | ||
autocomplete="off" | ||
name="{{ option.name }}" | ||
id="{{ option.attrs.id }}" | ||
{% if option.value != None %} value="{{ option.value|stringformat:'s' }}" | ||
{% if option.attrs.checked %} checked="checked"{% endif %}{% endif %} | ||
{% if widget.attrs.disabled %} disabled{% endif %} | ||
{% if widget.required %} required{% endif %}> | ||
<label class="btn btn-outline-primary" for="{{ option.attrs.id }}">{{ option.label }}</label> | ||
{% endfor %} | ||
{% endfor %} | ||
{% load django_bootstrap5 %} | ||
{% bootstrap_server_side_validation_class widget as server_side_validation_class %} | ||
<div{% include "django/forms/widgets/attrs.html" %}> | ||
<div class="btn-group" role="group"> | ||
{% for group, options, index in widget.optgroups %} | ||
{% for option in options %} | ||
<input type="{{ option.type }}" | ||
class="{{ widget.attrs.class|add:' btn-check' }}" | ||
autocomplete="off" | ||
name="{{ option.name }}" | ||
id="{{ option.attrs.id }}" | ||
{% if option.value != None %} value="{{ option.value|stringformat:'s' }}" | ||
{% if option.attrs.checked %} checked="checked"{% endif %}{% endif %} | ||
{% if widget.attrs.disabled %} disabled{% endif %} | ||
{% if widget.required %} required{% endif %}> | ||
<label class="btn btn-outline-primary" for="{{ option.attrs.id }}">{{ option.label }}</label> | ||
{% endfor %} | ||
{% endfor %} | ||
</div> | ||
</div> |