marksweb / django-bleach

Bleach is a Python module that takes any HTML input, and returns valid, sanitised HTML that contains only an allowed subset of HTML tags, attributes and styles. django-bleach is a Django app that makes using bleach extremely easy.
MIT License
148 stars 23 forks source link

Form field kwargs get ignored #23

Closed marksweb closed 3 years ago

marksweb commented 3 years ago

Describe the bug If you definekwargs for a form field, models.BleachField.formfield doesn't always pass on those kwargs.

To Reproduce Set a custom widget for a BleachField with no choices defined

Expected behavior The kwargs should be updated, not overridden so that anything set outside of django-bleach isn't ignored & lost.

Screenshots You can see here, a widget is passed in through kwargs but then kwargs aren't used in the returned field.

Screenshot 2021-07-27 at 11 11 58