Skip to content

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

License

Notifications You must be signed in to change notification settings

cuiks/django-quill-editor-with-resize

This branch is 21 commits ahead of, 62 commits behind LeeHanYeong/django-quill-editor:master.

Folders and files

NameName
Last commit message
Last commit date

Latest commit

6b9f1ad · Apr 9, 2021

History

39 Commits
Mar 17, 2020
Mar 23, 2021
Feb 9, 2021
Apr 9, 2021
Mar 23, 2021
Mar 5, 2020
Mar 5, 2020
Jun 9, 2020
Apr 9, 2021
Mar 5, 2020
Mar 23, 2021
Mar 23, 2021
Mar 23, 2021
Mar 23, 2021
Mar 23, 2021
Mar 23, 2021

Repository files navigation

django-quill-editor with image-resize

django-quill-editor @LeeHanYeong/django-quill-editor

quill-image-resize-module @kensnyder/quill-image-resize-module

This repo forked from LeeHanYeong/django-quill-editor, add quill-image-resize-module

By modify the demo proj(playground),achieved django-quill-editor resize image.

[email protected]/image-resize.min.js was introduced in the modification by the way of cdn https://cdn.jsdelivr.net/npm/[email protected]/image-resize.min.js.

modified

django-quill-editor/playground/templates/base.html line12 add

<head>
  <meta charset="UTF-8">
  <meta name="viewport"
        content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">

  <!-- django-quill-editor Media -->
  {% include 'django_quill/media.html' %}
  <!-- Quill resize-image.js -->
  <!-- image-resize.min.js must import after Quill.js. like this -->
  <script src="https://cdn.jsdelivr.net/npm/[email protected]/image-resize.min.js"></script>


  <!-- Custom CSS -->
  <link rel="stylesheet" href="{% static 'bootstrap.min.css' %}">
  <link rel="stylesheet" href="{% static 'style.css' %}">
  <title>django-quill-editor</title>
</head>

django-quill-editor/playground/config/settings.py line101 add

# Quill config
QUILL_CONFIGS = {
    "default": {
        'theme': 'snow',
        'modules': {
            'syntax': True,
            'toolbar': [
                [
                    {'font': []},
                    {'header': []},
                    {'align': []},
                    'bold', 'italic', 'underline', 'strike', 'blockquote',
                    {'color': []},
                    {'background': []},
                ],
                ['code-block', 'link', 'image', 'video'],
                ['clean'],
            ],
            'imageResize': {  # open imageResize
                'displaySize': True
            }
        }
    }
}

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

About

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

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 71.3%
  • HTML 25.9%
  • JavaScript 2.2%
  • CSS 0.6%