diff --git a/core/templates/core/child_radio.html b/core/templates/core/child_radio.html new file mode 100644 index 00000000..967d6847 --- /dev/null +++ b/core/templates/core/child_radio.html @@ -0,0 +1,8 @@ +{% with id=widget.attrs.id %} + + {% for group, options, index in widget.optgroups %} + {% for option in options %} + {% include option.template_name with widget=option %} + {% endfor %} + {% endfor %} + {% endwith %} diff --git a/core/templates/core/child_radio_option.html b/core/templates/core/child_radio_option.html index 0e6cb443..9c81c404 100644 --- a/core/templates/core/child_radio_option.html +++ b/core/templates/core/child_radio_option.html @@ -2,7 +2,8 @@ {% if widget.wrap_label %} {% endif %}{% include "django/forms/widgets/input.html" %} + for="{{ widget.attrs.id }}"{% endif %} + class="btn btn-outline-light btn-no-hover">{% endif %}{% include "django/forms/widgets/input.html" %} {% if widget.wrap_label %} {% include "core/child_thumbnail.html" with child=widget %} {{ widget.label }}{% endif %} diff --git a/core/widgets.py b/core/widgets.py index 6c39b944..8860a7a1 100644 --- a/core/widgets.py +++ b/core/widgets.py @@ -85,6 +85,7 @@ class TagsEditor(Widget): class ChildRadioSelect(RadioSelect): input_type = "radio" + template_name = "core/child_radio.html" option_template_name = "core/child_radio_option.html" def create_option(self, name, value, label, selected, index, subindex=None, attrs=None):