Update child radio for BS5

This commit is contained in:
Christopher C. Wells 2022-07-30 20:33:42 -07:00 committed by Christopher C. Wells
parent 44418b2906
commit 4e98d18448
2 changed files with 9 additions and 6 deletions

View File

@ -1,10 +1,7 @@
{% load imagekit static %} {% load imagekit static %}
{% if widget.wrap_label %}
<label{% if widget.attrs.id %} for="{{ widget.attrs.id }}"{% endif %} class="btn btn-outline-light btn-no-hover">
{% endif %}
{% include "django/forms/widgets/input.html" %} {% include "django/forms/widgets/input.html" %}
{% if widget.wrap_label %} <label{% if widget.attrs.id %} for="{{ widget.attrs.id }}"{% endif %} class="btn btn-outline-light btn-no-hover">
{% include "core/child_thumbnail.html" with child=widget %} {% include "core/child_thumbnail.html" with child=widget %}
{{ widget.label }}</label> {{ widget.label }}
{% endif %} </label>

View File

@ -87,6 +87,12 @@ class ChildRadioSelect(RadioSelect):
input_type = "radio" input_type = "radio"
template_name = "core/child_radio.html" template_name = "core/child_radio.html"
option_template_name = "core/child_radio_option.html" option_template_name = "core/child_radio_option.html"
attrs = {"class": "btn-check"}
def build_attrs(self, base_attrs, extra_attrs=None):
attrs = super().build_attrs(base_attrs, extra_attrs)
attrs["class"] += " btn-check"
return attrs
def create_option( def create_option(
self, name, value, label, selected, index, subindex=None, attrs=None self, name, value, label, selected, index, subindex=None, attrs=None