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
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.
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 usingforms.BleachField
. I found this confusing initially given Django's "don't repeat yourself" style.This can be solved by defining a
formfield
method in themodels.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.