django-quill-editor makes Quill.js easy to use on Django Forms and admin sites

Related tags

Django django quilljs
Overview

django-quill-editor

PyPI

django-quill-editor makes Quill.js easy to use on Django Forms and admin sites

  • No configuration required for static files!
  • The entire code for inserting WYSIWYG editor is less than 30 lines
  • It can be used in both admin and Django views

django-quill-editor

Documentation

The full document is in https://django-quill-editor.readthedocs.io/, including everything about how to use the Form or ModelForm, and where you can add custom settings.

Please refer to the QuickStart section below for simple usage.

QuickStart

Setup

  • Install django-quill-editor to your Python environment

    Requires Python 3.7 or higher and Django 3.1 or higher.

    pip install django-quill-editor
  • Add django_quill to INSTALLED_APPS in settings.py

    # settings.py
    INSTALLED_APPS = [
        'django.contrib.admin',
        ...
        'django_quill',
    ]

Making Model

Add QuillField to the Model class you want to use.

  1. App containing models.py must be added to INSTALLED_APPS
  2. After adding the app, you need to run makemigrations and migrate to create the DB table.
# models.py
from django.db import models
from django_quill.fields import QuillField

class QuillPost(models.Model):
    content = QuillField()

Using in admin

Just register the Model in admin.py of the app.

from django.contrib import admin
from .models import QuillPost

@admin.register(QuillPost)
class QuillPostAdmin(admin.ModelAdmin):
    pass

admin-sample

Contributing

As an open source project, we welcome contributions. The code lives on GitHub

Distribution (for owners)

PyPI Release

poetry install  # Install PyPI distribution packages
python deploy.py

Sphinx docs

brew install sphinx-doc  # macOS

Local

cd docs
make html
# ...
# The HTML pages are in _build/html.

cd _build/html
python -m http.server 3001
Comments
  • AttributeError 'NoneType' object has no attribute 'json_string'

    AttributeError 'NoneType' object has no attribute 'json_string'

    Initialized a new project this evening and installed django-quill-editor as per usual. When I open the associated CreateView template, I get...

    issue

    Funny thing is, the quill editor loads correctly in the UpdateView template. The following text is strangely already in the editor...

    issue_2

    I've double and triple checked that the model, view, and template are set-up correctly.

    EDIT

    Realized it might help to add that I am also using django-crispy-forms.

    opened by lucaswatterson 12
  • Docs didn't say to include the tag in the form.

    Docs didn't say to include the tag in the form.

    I was looking at the docs but I thing it's missed to be told that {% include 'django_quill/media.html' %} is to be included. I wasted lot of time on this.

    opened by Teut2711 6
  • How do you suppose displaying the content on an html template

    How do you suppose displaying the content on an html template

    The editor works well, but displaying Quill content is kinda.... for and instance object.content will display something of this sort: <django_quill.fields.FieldQuill object at 0x7ff51c405190> What are the suggestions here?

    opened by ericel 5
  • QuillField not showing in django admin

    QuillField not showing in django admin

    I know this has been asked before #51, but the owner closed the issue without providing any feedback.

    Quill editor v0.1.40 works fine on my local computer, but when in production, QuillFileds are invisible on admin panel – only labels appear:

    Screen-Shot-2022-03-09-at-1-15-26-PM

    When inspecting the admin page on Chrome, I see such errors on the console:

    GET https://mysite.com/static/django_quill/django_quill.css net::ERR_ABORTED 404 (Not Found)
    
    GET https://mysite.com/static/django_quill/django_quill.js net::ERR_ABORTED 404 (Not Found)
    
    Uncaught ReferenceError: QuillWrapper is not defined
        at (index):261:27
        at (index):263:11
    

    django_quill.css and django_quill.js fail to load. I can't figure out why it works on my local project which has the same setup, except that on local I use python 3.9/Django 4.0.1 while in production, it's v3.8/4.0.2.

    Another difference is that, in production, django_quill folder is under myenv/lib/python3.8/site-packages/ directory.

    On my computer, there is no django_quill folder under myenv/lib/python3.9/site-packages/. In fact, there is no such folder anywhere on my drive, nor the related django_quill.css or django_quill.js files.

    I have no problem while migrating from old TextField's, or viewing the content on the templates.

    Any suggestion or feedback will be welcomed and greatly appreciated.

    Thank you.

    opened by tigrettin 4
  • Migrating HTML

    Migrating HTML

    When I change an existing field type to QuillField it fails because it is expecting its value to be in the delta/html format {"delta": "...", "html": "..."}, but my current data is just raw HTML. Does anyone have any tips on how to migrate this data?

    opened by djpeacher 4
  • Fixing issue #38 AttributeError 'NoneType' object has no attribute 'json_string'

    Fixing issue #38 AttributeError 'NoneType' object has no attribute 'json_string'

    Related issue #38 and fixes the issue of json

    This PR and PR#36 are breaking changes for Django Versions < 3.1.x

    The JSONField was introduced in Django 3.1. django-quill-editor will have to drop support for django 3.0.x versions.

    opened by cdesch 4
  • QuillField not showing in django admin

    QuillField not showing in django admin

    I'm working with Django 3.1.8 models.py

    class UUIDModel(models.Model):
        class Meta:
            abstract = True
    
        id = UUIDPrimaryKeyField()
        
    class Setup(UUIDModel):
        name = models.CharField(max_length = 255, verbose_name = "Nome")
        content = QuillField()
    

    admin.py

    @admin.register(Setup)
    class SetupAdmin(admin.ModelAdmin):
        pass
    

    I made the migrations , migrate, all the proccess. The label content appear in the admin but has no field to write....

    opened by brunocpradom 3
  • QuillParseError: Failed to parse value(random string). Django Admin

    QuillParseError: Failed to parse value(random string). Django Admin

    Hello,

    I am trying to integrate the QuillField() into the Django admin. However, when I change the model from textField to QuillField(), I get a QuillParseError whenever I try to edit existing objects in the Django admin.

    How would you resolve this error?

    opened by brian101co 3
  • rewrite QuillField to inherit JSONField

    rewrite QuillField to inherit JSONField

    this allows the db backend to apply any optimizations it might want/need closes #26

    checked everything out in a personal project. i can use the admin panel with a QuillField just fine, multiple edits work fine, and everything renders properly. i also checked my db (postgres) and the json getting stored is correct

    opened by ghost 3
  • QuillField parse error if null

    QuillField parse error if null

    If QuillField is not populated, it causes JSONParse error. It can be field by overriding FieldQuill.__init__ with:

    def __init__(self, instance, field, json_string):
        json_string = json_string or '{"delta":"","html":""}'
        super().__init__(instance, field, json_string)
    

    After that, QuillField blank and null arguments can be set to True.

    opened by michaldyczko 3
  • Should support inital value

    Should support inital value

    Have you considered adding an initial value placeholder?

    With what you have now, I doubt it will work with editing pages where there's suppose to be some initial value that is to be displayed on the editor.

    opened by ericel 3
  • Bump certifi from 2022.6.15 to 2022.12.7

    Bump certifi from 2022.6.15 to 2022.12.7

    Bumps certifi from 2022.6.15 to 2022.12.7.

    Commits

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    • @dependabot use these labels will set the current labels as the default for future PRs for this repo and language
    • @dependabot use these reviewers will set the current reviewers as the default for future PRs for this repo and language
    • @dependabot use these assignees will set the current assignees as the default for future PRs for this repo and language
    • @dependabot use this milestone will set the current milestone as the default for future PRs for this repo and language

    You can disable automated security fix PRs for this repo from the Security Alerts page.

    dependencies 
    opened by dependabot[bot] 0
  • Registering unconfigured modules

    Registering unconfigured modules

    I ran into a similar issue as described in https://github.com/LeeHanYeong/django-quill-editor/issues/90#issuecomment-1174955291 and copying that user's suggested solution also fixed it for me.

    opened by erikfinnegan-lightmatter 0
  • Integrate with Django Rest Framework

    Integrate with Django Rest Framework

    Hey!

    I was trying to use the editor with DRF, but when DRF serializes the field, it just calls str method, which returns that default python str for classes. If we instead return the delta, it will be possible to integrate with the serializer just fine.

    I will open a PR to do so.

    opened by Enzodtz 1
  • Is there a way to post iframes within Django template with Quill?

    Is there a way to post iframes within Django template with Quill?

    Problem:

    When trying to display iframe from Quill onto webpage, it only displays the html and not the actual iframe

    Context:

    I am using Quill in my admin backend so that I can easily let an admin user add text and links onto a webpage.

    Here is what the backend quill form looks like Screen Shot 2022-10-10 at 8 44 01 PM

    I've added safe within the template fields so that URLs display correctly.

    <div class="container">
       <br>
       <h2>Where to Buy {{ plant.name }}</h2>
       <div class="affiliate-section">
               {{ plant.affiliate_link.html | safe }}
       </div>
    

    Using safe allows me to display most HTML elements like <p>, <br>, <a href>, and others easily. However, I am not able to get iframes to display correctly. Is there a way around this?

    Here is an example of how it displays on the webpage: Screen Shot 2022-10-10 at 8 51 59 PM

    Would I possibly need to add a new item to the toolbar to allow for iframes to be added the same way that videos do? If so, how can I add that?

    Looking through the Django Quill Documentation and original JS Quill documentation did not lead me to the solution I seek.

    Thank you for any help.

    opened by marytaylor 0
The Django Leaflet Admin List package provides an admin list view featured by the map and bounding box filter for the geo-based data of the GeoDjango.

The Django Leaflet Admin List package provides an admin list view featured by the map and bounding box filter for the geo-based data of the GeoDjango. It requires a django-leaflet package.

Vsevolod Novikov 33 Nov 11, 2022
A Django application that provides country choices for use with forms, flag icons static files, and a country field for models.

Django Countries A Django application that provides country choices for use with forms, flag icons static files, and a country field for models. Insta

Chris Beaven 1.2k Jan 7, 2023
A Django application that provides country choices for use with forms, flag icons static files, and a country field for models.

Django Countries A Django application that provides country choices for use with forms, flag icons static files, and a country field for models. Insta

Chris Beaven 1.2k Dec 31, 2022
Django-Audiofield is a simple app that allows Audio files upload, management and conversion to different audio format (mp3, wav & ogg), which also makes it easy to play audio files into your Django application.

Django-Audiofield Description: Django Audio Management Tools Maintainer: Areski Contributors: list of contributors Django-Audiofield is a simple app t

Areski Belaid 167 Nov 10, 2022
Money fields for Django forms and models.

django-money A little Django app that uses py-moneyed to add support for Money fields in your models and forms. Django versions supported: 1.11, 2.1,

null 1.4k Jan 6, 2023
Keep track of failed login attempts in Django-powered sites.

django-axes Axes is a Django plugin for keeping track of suspicious login attempts for your Django based website and implementing simple brute-force a

Jazzband 1.1k Dec 30, 2022
A set of high-level abstractions for Django forms

django-formtools Django's "formtools" is a set of high-level abstractions for Django forms. Currently for form previews and multi-step forms. This cod

Jazzband 621 Dec 30, 2022
django Filer is a file management application for django that makes handling of files and images a breeze.

django Filer is a file management application for django that makes handling of files and images a breeze.

django CMS Association 1.6k Jan 6, 2023
Intellicards-backend - A Django project bootstrapped with django-admin startproject mysite

Intellicards-backend - A Django project bootstrapped with django-admin startproject mysite

Fabrizio Torrico 2 Jan 13, 2022
The pytest framework makes it easy to write small tests, yet scales to support complex functional testing

The pytest framework makes it easy to write small tests, yet scales to support complex functional testing for applications and libraries. An example o

pytest-dev 9.6k Jan 6, 2023
☄️ Google Forms autofill script

lazrr 'Destroy Them With Lazers' - Knife Party, 2011 Google Forms autofill script Installation: pip3 install -r requirements.txt Usage: python3 lazrr.

Serezha Rakhmanov 12 Jun 4, 2022
A CBV to handle multiple forms in one view

django-shapeshifter A common problem in Django is how to have a view, especially a class-based view that can display and process multiple forms at onc

Kenneth Love 167 Nov 26, 2022
Django application and library for importing and exporting data with admin integration.

django-import-export django-import-export is a Django application and library for importing and exporting data with included admin integration. Featur

null 2.6k Dec 26, 2022
Simply integrate Summernote editor with Django project.

django-summernote Summernote is a simple WYSIWYG editor. django-summernote allows you to embed Summernote into Django very handy. Support admin mixins

Summernote 936 Jan 2, 2023
Awesome Django Markdown Editor, supported for Bootstrap & Semantic-UI

martor Martor is a Markdown Editor plugin for Django, supported for Bootstrap & Semantic-UI. Features Live Preview Integrated with Ace Editor Supporte

null 659 Jan 4, 2023
Django admin CKEditor integration.

Django CKEditor NOTICE: django-ckeditor 5 has backward incompatible code moves against 4.5.1. File upload support has been moved to ckeditor_uploader.

null 2.2k Jan 2, 2023
Django admin CKEditor integration.

Django CKEditor NOTICE: django-ckeditor 5 has backward incompatible code moves against 4.5.1. File upload support has been moved to ckeditor_uploader.

null 2.2k Dec 31, 2022
Add Chart.js visualizations to your Django admin using a mixin class

django-admincharts Add Chart.js visualizations to your Django admin using a mixin class. Example from django.contrib import admin from .models import

Dropseed 22 Nov 22, 2022
📝 Sticky Notes in Django admin

django-admin-sticky-notes Share notes between superusers. Installation Install via pip: pip install django_admin_sticky_notes Put django_admin_sticky_

Dariusz Choruży 7 Oct 6, 2021