pythondjangockeditordjango-ckeditor

Can't use CKEDITOR in django template


I am using a form without a model class.

class ClubWallForm(forms.Form):

    title = forms.CharField(label='Post title', max_length=100)
    description = RichTextField()
    imgURL = forms.CharField(label='Post image url', max_length=100)
    filefield = forms.FileField( label='Select a file',validators=[validate_file_extension] )

In my template I used

`        {% for field in form %}
            <div class="fieldWrapper">
                {{ field.errors }}
                {{ field.label_tag }}: {{ field }}
            </div>
        {% endfor %}`

CKEDITOR is not geting displayed in my template. This is what I am getting.

Inside my views it tried to use ipdb and found that the form has only fields title imgurl and filefield .

enter image description here


Solution

  • Finally I got an answer from my friend. it was to replace

    description = RichTextField()
    

    with

    description = forms.CharField(label='Description',
                       widget=forms.Textarea(attrs={'class': 'ckeditor'}))
    

    inside forms.py and it is working enter image description here