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+

Usage

  • 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

Development

  1. Test Coverage
coverage run ./manage.py test
  1. Test multiple django versions
tox

Metadata

Release files for django-kindeditor 0.2.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.2.0
File Size Uploaded Provenance Actions
django-kindeditor-0.2.0.tar.gz 516.3 kB Without provenance Details for django-kindeditor-0.2.0.tar.gz

Built distribution (wheel)

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

Total release size: 1.1 MB

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

Download URL django-kindeditor-0.2.0.tar.gz
Size 516.3 kB
Tags Source
SHA-256 checksum
How to use checksums
a7b3fb615623e4f1afb52428a4a3bcddb5118a999fff4abebff0f59adf45f2e7
BLAKE2b-256 checksum
How to use checksums
01ccd18be3449e5c33e2ebffe4dcc7e1a0bef575d91f7a50076a96d4376ae492
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.8.0b1

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

Download URL django_kindeditor-0.2.0-py2.py3-none-any.whl
Size 590.9 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
17636206020447fb436eed2a2491a8780589f80aa7b1e66dcddfbbd1ea896212
BLAKE2b-256 checksum
How to use checksums
61c8126fabf0d8bf75771ac546c9ea1fc2111d0db68d1f061d81cbdbc5958ad5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.8.0b1

Security for django-kindeditor 0.2.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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