From 4e98d18448118899a1f908885b894a92c7a7e97c Mon Sep 17 00:00:00 2001 From: "Christopher C. Wells" Date: Sat, 30 Jul 2022 20:33:42 -0700 Subject: [PATCH] Update child radio for BS5 --- core/templates/core/child_radio_option.html | 9 +++------ core/widgets.py | 6 ++++++ 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/core/templates/core/child_radio_option.html b/core/templates/core/child_radio_option.html index dd7a6d37..a14d5fe9 100644 --- a/core/templates/core/child_radio_option.html +++ b/core/templates/core/child_radio_option.html @@ -1,10 +1,7 @@ {% load imagekit static %} -{% if widget.wrap_label %} - -{% endif %} {% include "django/forms/widgets/input.html" %} -{% if widget.wrap_label %} + {% include "core/child_thumbnail.html" with child=widget %} - {{ widget.label }} -{% endif %} + {{ widget.label }} + diff --git a/core/widgets.py b/core/widgets.py index 7f708cbf..9d098cc2 100644 --- a/core/widgets.py +++ b/core/widgets.py @@ -87,6 +87,12 @@ class ChildRadioSelect(RadioSelect): input_type = "radio" template_name = "core/child_radio.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( self, name, value, label, selected, index, subindex=None, attrs=None