Skip to main content

django-editorjs-field

This module integrates the Editor.js widget into model/form fields for Django.

Warning

This is an early prototyp and work in progress

Installation

Install with Pip:
pip install django-editorjs-field

Django Setup

settings.py

INSTALLED_APPS = [
    ...
    'editorjs_field',
    ...
]

Use in Django admin

models.py

from django.db import models
from editorjs_field.fields import EditorJSField


class Article(models.Model):
    title = models.CharField(max_length=100)
    content = EditorJSField()

admin.py

from django.contrib import admin
from .models import Article


class ArticleAdmin(admin.ModelAdmin):
    list_display = ('title',)


admin.site.register(Article, ArticleAdmin)

Use the widget in a custom form

forms.py

from django import forms
from editorjs_field.widgets import EditorJsWidget

class ArticleEditorForm(forms.Form):
    title = forms.CharField(label='Title')
    document = forms.CharField(label='Document', widget=EditorJsWidget)

Examples & Development

An example can be found in the example folder. To run them clone the repository and run:

$ cd django-editorjs-field
$ pipenv install
$ pipenv shell
$ cd example
$ python manage.py migrate
$ python manage.py createsuperuser
$ python manage.py runserver

Visit http://localhost:8000/admin to view the admin widget and http://localhost:8000/ to view the custom form widget.

Metadata

Release files for django-editorjs-field 0.0.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for django-editorjs-field 0.0.3
File Size Uploaded
django-editorjs-field-0.0.3.tar.gz 90.0 kB Details

Release files / django-editorjs-field-0.0.3.tar.gz

Download URL django-editorjs-field-0.0.3.tar.gz
Size 90.0 kB
Tags Source
SHA-256 checksum
How to use checksums
f76e476ce756b0f0ec9ba85b380a24236f0c00e91479a9d6bb2cf4bbecdbcb5c
BLAKE2b-256 checksum
How to use checksums
eab8cde8cb1a9c9cfeffc2e9cc0b1b5a476f9a90408a17178dea6ff398b359ff
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.3

Release history Release notifications | RSS feed

This release

0.0.3 This release

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page