[Answer]-Django model force tags

1👍

A div is not a field.

You’ve misunderstood the issue that you link to. You still need a textarea, otherwise you can’t submit the content. The wysiwyg library takes care of displaying an editable div, but it looks like it’s up to you [*] to take care of populating that div from the textarea, and copying the edited text back to the textarea on submit, both of which you should do in Javascript.

So, here are the steps:

  • Output the field as a normal textarea.
  • In JS, when the page loads, copy the text to a div and instantiate the wsysiwyg library, then hide the textarea.
  • On submit, copy the edited text back to the textarea.

[*] slightly strangely: most rich-text editor JS libraries have code to do that for you.

Leave a comment