From f935b50a5fc24b97cf27c0aee164b38561f26345 Mon Sep 17 00:00:00 2001 From: Danni Randeris Date: Fri, 25 Oct 2024 09:28:29 +0200 Subject: [PATCH] Update RadioSelectButtonGroup() with form validation and non-horizontal alignment. --- docs/widgets.rst | 2 -- .../widgets/radio_select_button_group.html | 34 +++++++++++-------- 2 files changed, 19 insertions(+), 17 deletions(-) diff --git a/docs/widgets.rst b/docs/widgets.rst index b4f7c40b..da8c37bc 100644 --- a/docs/widgets.rst +++ b/docs/widgets.rst @@ -8,8 +8,6 @@ A form widget is available for displaying radio buttons as a Bootstrap 5 button RadioSelectButtonGroup ~~~~~~~~~~~~~~~~~~~~~~ -*Known issue: This widget currently renders as a regular Bootstrap 5 RadioSelect.* - This renders a form ChoiceField as a Bootstrap 5 button group in the `primary` Bootstrap 5 color. .. code:: django diff --git a/src/django_bootstrap5/templates/django_bootstrap5/widgets/radio_select_button_group.html b/src/django_bootstrap5/templates/django_bootstrap5/widgets/radio_select_button_group.html index 625d093c..5f74c33b 100644 --- a/src/django_bootstrap5/templates/django_bootstrap5/widgets/radio_select_button_group.html +++ b/src/django_bootstrap5/templates/django_bootstrap5/widgets/radio_select_button_group.html @@ -1,16 +1,20 @@ - - {% for group, options, index in widget.optgroups %} - {% for option in options %} - - - {% endfor %} - {% endfor %} +{% load django_bootstrap5 %} +{% bootstrap_server_side_validation_class widget as server_side_validation_class %} + +
+ {% for group, options, index in widget.optgroups %} + {% for option in options %} + + + {% endfor %} + {% endfor %} +