This morning, I dedicated my time to going through numerous tutorials on YouTube that explain how to build your own WYSIWYG editor. After testing the code in a controlled environment, it seems to function correctly and delivers the customization promised. However, integrating this code into a Django app has proven to be problematic. Despite my efforts to place my Django form variable in different locations, every time I attempt to input user data into the new WYSIWYG editor, the screen refreshes and errors pop up. My HTML utilizes an iframe, and I am wondering if there is a simple solution to this issue or if it would be better to opt for one of the many existing WYSIWYG editors available. My end goal is to save the data to a Postgresql database, but I am struggling to move the data from the screen to the database.
Here is a snippet of my HTML:
<div class="textarea">
{{ form.textarea }}
</div>
The challenge lies in associating the custom WYSIWYG editor with this specific variable. I have a model in place, and that seems to be working fine. However, when it comes to defining a WYSIWYG editor in my HTML, I'm unable to link it to a particular field. I want to submit the form with the associated HTML fields and changes to a Postgresql database. Would using Ajax help in this situation? I've also experimented with SummerNote, but the issue persists. The editor displays in my HTML, but I can't seem to connect it with one specific field like 'book' as shown below:
<div class="spacer89">
<label class="label6">Book</label>
<div id="summernote">
{{ form.book }}
</div>
</div>
<script>
$('#summernote').summernote({
placeholder: '',
tabsize: 2,
width: 800,
height: 200
});
</script>
</div>
I'm not utilizing {{ form.as_p }} and working with individual variable names, but I'm struggling to link the summernote editor with my 'book' field.