0

I have django-bleach in my project. In models use:

class Post(models.Model):

    title = models.CharField(max_length=255)
    content_2 = HTMLField()

In settings.py:

BLEACH_DEFAULT_WIDGET = 'wysiwyg.widgets.WysiwygWidget'

How to write the correct path to process the bleach for HTMLField in BLEACH_DEFAULT_WIDGET ?

Sergey Ka
  • 25
  • 9

1 Answers1

0

So I think what you're saying is you need bleach to use the TinyMCE widget in your form.

(Assuming you're using django-tinymce)

The setting would be BLEACH_DEFAULT_WIDGET = 'tinymce.widgets.TinyMCE'

Because you're using HTMLField on the model you'll need to define a form for your model that then uses BleachField in order for bleach to be involved.


class MyModelForm(forms.ModelForm):

    content_2 = BleachField(
        max_length=100,
        strip_tags=True,
        allowed_tags=[]
    )

    class Meta:
        model = Post
markwalker_
  • 12,078
  • 7
  • 62
  • 99