Chosen - Select Box


Add the following to your form template (probably below the {% endblock content %} block):

{% block script_extra %}
  {{ block.super }}
  {% include 'base/_chosen.html' %}
{% endblock script_extra %}

Any element with a class of chosen-select will become a chosen drop-down box. You can add this in the __init__ method of a form e.g:

class MailChimpSettingsForm(forms.ModelForm):
    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)
        f = self.fields["default_consent"]
        f.widget.attrs.update({"class": "chosen-select"})