django-wysiwyg
django-wysiwyg copied to clipboard
Error "This field is required" only when using WYSIWYG on field
When using a normal TextField without django-wysiwyg, I can save my form perfectly fine, but when using django-wysiwyg I get an error "This field is required" on the TextField I want to use the WYSIWYG on. This does not make a difference if I change editor.
{% extends "base.html" %}
{% block content %}
{% load wysiwyg %}
{% wysiwyg_setup %}
<div class="ui header">Create New Post</div>
<form method='POST' action='{% url "bpcpost:new_post" %}' enctype='multipart/form-data'>
{% csrf_token %}
<table class="ui celled striped red table">
{{ form.as_table }}
</table>
<input type='submit' class='ui red button' value='Save'/>
</form>
{% wysiwyg_editor "wysiwyg_content" %}
{% endblock content %}
My model is very simple:
class Post(models.Model):
title = models.CharField(max_length=50)
content = models.TextField(max_length=5000)
slug = models.SlugField(unique=True)
author = models.ForeignKey(settings.AUTH_USER_MODEL, default=1)
draft = models.BooleanField(default=False)
I had the same error, when I specify widget=forms.Textarea
on the wysiwyg field, the error is gone.
Many thanks for the response, I'll try it out. I switched to directly using ckeditor in the meantime but I prefer the flexibility of django-wysiwyg.