Package: django-bootstrap-input-group
django-bootstrap-input-groupThis is an add-on fordjango-bootstrap5for rendering multiple
django form fields as aBootstrap input group.RequirementsDjango 3.2 or newer and django-bootstrap5.InstallationInstall using pip:pipinstalldjango-bootstrap-input-groupAdd toINSTALLED_APPSin yoursettings.py:INSTALLED_APPS=[# ..."django_bootstrap_input_group"# ...]PreviewCheck out the little demo:git clone https://github.com/Actionb/django-bootstrap-input-group.git
cd django-bootstrap-input-group/demo
pip install -r requirements.txt
python manage.py runserverThen visit the demo forms onhttp://127.0.0.1:8000/.UsageIn your templates, load the template tag setdjango_bootstrap_input_group.  Then you can render an input group of fields either by:declaring the groups in afield_groupsattribute on your form and using thebootstrap_grouped_formtemplate tag to render that formusing thebootstrap_input_grouptemplate tag to render a single groupUsingfield_groupsform attribute:Declarefield_groupson your form:fromdjangoimportformsclassContactForm(forms.Form):first_name=forms.CharField()last_name=forms.CharField()notes=forms.CharField()field_groups=[('Name',('first_name','last_name')),'notes']Then in your templates:{% load django_bootstrap_input_group %}

{# Load CSS and JavaScript #}
{% bootstrap_css %}
{% bootstrap_javascript %}<form>{# Render a form as a grouped form #}
    {% bootstrap_grouped_form form %}
    
    {# Or for formsets #}
    {% bootstrap_grouped_formset formset %}</form>field_groupscontains the names of form fields in the order that they should be rendered in, with nested lists
(or tuples) of names representing a group. The nested list can be either a flat list, or a two-item list, where
the first item is the label for the group and the second is the list of field names:# No groups - just field names:field_groups=['first_name','last_name','notes']# first_name and last_name make up a group, but no group label is specified:field_groups=[('first_name','last_name'),'notes']# first_name and last_name make up a group, with the group label "Name":field_groups=[('Name',('first_name','last_name')),'notes']If no label is provided, the label of the first field in a group is used as the label for the group.Using the input group template tag:Or you can just render a group of fields directly, using thebootstrap_input_grouptemplate tag:{% load django_bootstrap5 django_bootstrap_input_group %}<form>{% bootstrap_input_group form.first_name form.last_name label="Name" %}
    {% bootstrap_field form.notes %}</form>Template tag argumentsThebootstrap_input_grouptag takes (bound) form fields as positional arguments.
It also takes an optional keyword argumentlabelwhich specifies the label for the group
(if no label is provided, it defaults to the label of the first field in a group).Other than that, thedjango_bootstrap_input_grouptemplate tags take the same arguments as theirdjango_bootstrap5counterparts
(see here for alist of the template tags and their parameters).CSSThis package ships with an additional css filedjango_bootstrap_input_group/css/bootstrap_input_group.csswhich includes rules that tweak the look ofRadioSelectButtonGroupwidgets when rendered inside an input group.
The rules:vertically align the label text of the optionsremove rounded corners of label elements (where necessary)Simply include the css file in yourform's media(also:How to manage static files).