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

Use forms.BleachField when models.BleachField is used #13

Closed osamak closed 3 years ago

osamak commented 4 years ago

When defining a model field using models.BleachField, it won't automatically reflect on the ModelForm field. Instead, the form field has to be defined separately using forms.BleachField. I found this confusing initially given Django's "don't repeat yourself" style.

This can be solved by defining a formfield method in the models.BleachField class (documentation).

Is there a reason why things are the way they are? If you are you happy with this change, I will submit a pull request.

marksweb commented 4 years ago

Hi, that certainly makes sense. Happy for a PR.

As for a reason, I've not really considered it since I took over the project.