Using as Form

Add the CSS and JS to the <head> of the template or base template.

There are two ways to add CSS and JS files to a template.

  • If there is a Form with QuillField added, add {{ }} to the <head> tag.

        {{ }}
  • Or, import CSS and JS files directly using {% include %} template tags.

        <!-- django-quill-editor Media -->
        {% include 'django_quill/media.html' %}

Add QuillFormField to the Form class you want to use.

from django import forms
from django_quill.forms import QuillFormField

class QuillFieldForm(forms.Form):
    content = QuillFormField()

Add a Form instance containing QuillFormField to the template context in the view.

from django.shortcuts import render
from .forms import QuillFieldForm

def form_view(request):
    return render(request, 'form_view.html', {'form': QuillFieldForm()})

In the template, use the received Form instance variable. (in the above case, ‘form’)

<!-- form_view.html -->
<form action="" method="POST">{% csrf_token %}
    {{ form.content }}