Giter VIP home page Giter VIP logo

django-quilljs's Introduction

django-quilljs

Build Status Latest Version

Easily use Quill.js in your django admin.

This project forked from django-quill.

Requires django 2.1.5

Admin Preview

Quick start

  1. Install the package from pypi

    pip install django-quilljs
  2. Add "quilljs" to your INSTALLED_APPS setting like this:

    INSTALLED_APPS = (
        ...
        'quilljs',
    )

Usage

from django.db import models
from quilljs.fields import RichTextField


class MyModel(models.Model):
    content = RichTextField()
    content2 = RichTextField(config='basic')

If you want to support image uploads, your admin needs to extend from quilljs.admin.QuillAdmin:

from quilljs.admin import QuillAdmin

class MyAdmin(QuilljsAdmin):
    pass

If you don't want to touch your models and enable the editor for all text fields in the admin page, you can do as well:

from quilljs.widgets import QuillEditorWidget
from quilljs.admin import QuillAdmin


class MyAdmin(admin.ModelAdmin):
    formfield_overrides = {
        models.TextField: {'widget': QuillEditorWidget},
    }

Customizing

To customize this app, extend apps.QuilljsConfig and modify whatever you need. For example, to add a new toolbar:

from quill.apps import QuilljsConfig


class MyQuilljsConfig(QuilljsConfig):
    my_toolbar = dict(full, toolbar_template='quill/toolbars/my_toolbar.html')

To customize the extensions of the images that can be uploaded:

from quill.apps import QuilljsConfig


class MyQuilljsConfig(QuilljsConfig):
    allowed_image_extensions = ['jpeg', 'gif']

If you need to call other methods or perform additional actions on the quill editors, they will be available in window.DjangoQuillEditors.

Provided Toolbars

There are two toolbars that come with this package:

  1. Full (default): Provides basic font style and size selection, bold, italics, underline, strikethrough, text color, background color, lists, links, and images.
  2. Basic: Provides bold, italic, underline, lists, and links.

Development

There are several dependencies on npm that are required before building django-quilljs:

$ npm install

Auto Compile JS

$ make watch

Running Tests

$ make test

Building JS

$ make build

TODO

  1. Better documentation.
  2. More tests.
  3. Better support for using outside of the admin.

django-quilljs's People

Contributors

muke5hy avatar rsenk330 avatar toppace avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.