[Answered ]-Django-summernote : How can I make it work based on model form?

2👍

In PostNewView you need to add form_class

class PostNewView(CreateView):
    model = Post
    form_class = PostForm
    template_name = "posts/post_edit.html"
    fields = ['title', 'content']

or you can override the get_form method in the PostNewView as

class PostNewView(CreateView):
    model = Post
    template_name = "posts/post_edit.html"
    fields = ['title', 'content']

   def get_form(self, form_class):
        form = super(PostNewView, self).get_form(form_class)
        form.fields['content'].widget = SummernoteInplaceWidget()
        return form
👤Javed

Leave a comment