Skip to main content

django-kindeditor

image image image image image image image

This repo is to make it easy to use KindEditor as a RichTextEditor when using django.

You can visit this site to see the editor result: http://kindeditor.org/

Chinese[中文版]

Requires

  • Django 2.0+
  • Python 3.6+

Use

  • Install
pip install django-kindeditor
  • Add kindeditor to INSTALL_APPS in settings, and define static, media
INSTALLED_APPS = [
    ...
    'kindeditor',
]
...

STATIC_URL = '/static/'
STATIC_ROOT = os.path.join(BASE_DIR, 'static')  # your static files path
MEDIA_URL = '/media/'
MEDIA_ROOT = os.path.join(BASE_DIR, 'media')  # your media files path
  • Insert "kindeditor/" path and static, media paths to urlpatterns in urls.py
from django.conf import settings

if settings.DEBUG:
    # static and media
    from django.conf.urls.static import static
    from django.contrib.staticfiles.urls import staticfiles_urlpatterns

    urlpatterns.extend(
        staticfiles_urlpatterns()
        + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
    )
urlpatterns = [
    ...
    path("kindeditor/", include("kindeditor.urls")),
]

if settings.DEBUG:
    # static and media
    from django.conf.urls.static import static
    from django.contrib.staticfiles.urls import staticfiles_urlpatterns

    urlpatterns.extend(
        staticfiles_urlpatterns()
        + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
    )

Example

# models.py
from kindeditor import RichTextField

class Article(models.Model):
    title = models.CharField(max_length=80)
    content = RichTextField()

# settings.py
KINDEDITOR_UPLOAD_PERMISSION = 'admin'

# admin.py
from django.contrib import admin
from kindeditor import EditorAdmin
from .models import Article
admin.site.register(Article, EditorAdmin)

Demo

  1. Clone the repo to local

    git clone https://github.com/waketzheng/django-kindeditor
    
  2. Create a virtual environment and install required packages

    pipenv install --dev
    
  3. Activate it

    pipenv shell
    
  4. Migrate and compile translation file

    ./manage.py migrate
    ./manage.py compilemessages
    
  5. Runserver

    ./manage.py runserver
    
  6. View the url and you will see the demo at webbrowser.

    http://127.0.0.1:8000

Metadata

Release files for django-kindeditor 0.1.0

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-kindeditor 0.1.0
File Size Uploaded
django-kindeditor-0.1.0.tar.gz 516.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for django-kindeditor 0.1.0
File Interpreter ABI Platform
django_kindeditor-0.1.0-py2.py3-none-any.whl Python 3, Python 2 none any Details

Total release size: 1.1 MB

Release files / django-kindeditor-0.1.0.tar.gz

Download URL django-kindeditor-0.1.0.tar.gz
Size 516.3 kB
Tags Source
SHA-256 checksum
How to use checksums
d4786843f5c041ee53345e737a6653798968d56d21c7016cf49cfe302b4f208e
BLAKE2b-256 checksum
How to use checksums
d86ce382f4debc1bf55d84454177f6db83b0b64e4569abe82be8f5e2d97674d9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.12.1 pkginfo/1.4.2 requests/2.20.1 setuptools/40.6.2 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.7.1

Release files / django_kindeditor-0.1.0-py2.py3-none-any.whl

Download URL django_kindeditor-0.1.0-py2.py3-none-any.whl
Size 590.9 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
41734cce5e6e2c4523912bb4f2bd91bf8ff8a7c8744096488ffabad1425aba35
BLAKE2b-256 checksum
How to use checksums
9a3e17fdc1868ba8e34e561b59e12ec5d8bc26976aa8cb649af33f81eab1f060
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.12.1 pkginfo/1.4.2 requests/2.20.1 setuptools/40.6.2 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.7.1

Release history Release notifications | RSS feed

0.3.0

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.1

2 release files

This release

0.1.0 This release

2 release files

0.0.4

2 release files

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