Django Bleach with CKeditor?

64 views Asked by At

Good morning, have you already configured Django Bleach for CKEDITOR? Actually I'm using a form with Django. And I use CKEDITOR to be able to write. But is there a configuration to use Django Bleach with? Because in my template I use |safe.

THANKS

I want to safe the data send with ckeditor.

models.py

class Comment(models.Model):
    content = RichTextField(verbose_name="Message")

forms.py

class IdeaCommentForm(forms.ModelForm):
    captcha = ReCaptchaField(widget=ReCaptchaV2Checkbox)

    class Meta:
        model = Comment
        fields = ["content"]

views.py

if request.method == "POST":
        form = IdeaCommentForm(request.POST)
        if form.is_valid():
            form.instance.user = user
            form.instance.idea = idea
            form.save()
            return redirect(idea)
    else:
        form = IdeaCommentForm()

hrml

<div class="card-body">

    <p class="card-text">{{ comment.content|safe }}</p>

  </div>

thks !

0

There are 0 answers