zostera/django-bootstrap4

Modify all field attrs with bootstrap_form?

Closed this issue · 1 comments

Is there a way to set a blanket (all-field) attribute with bootstrap_form? For example,

{% bootstrap_form form placeholder='' %}

does not seem to do anything. The documentation hints at "See bootstrap_field_ for other arguments" suggesting that these can be passed into bootstrap_form.

Instead I'm stuck with removing placeholder for each individual attribute which is kind of the opposite of DRY:

    ...
        widgets = {
            "coordinates": forms.HiddenInput(),
            "listed_longer_than": forms.NumberInput(
                attrs={
                    "placeholder": "",
                },
            ),
            "listed_shorter_than": forms.NumberInput(
                attrs={
                    "placeholder": "",
                },
            ),
        }

Figured this one out, at least for placeholder -

# settings.py

BOOTSTRAP4 = {
    ...
    "set_placeholder": False,
}