django-kindeditor
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/
Requires
- Django 2.0+
- Python 3.6+
Usage
- Install
pip install django-kindeditor
- Add
kindeditorto 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
-
Clone the repo to local
git clone https://github.com/waketzheng/django-kindeditor
-
Create a virtual environment and install required packages
pipenv install --dev
-
Activate it
pipenv shell -
Migrate and compile translation file
./manage.py migrate ./manage.py compilemessages
-
Runserver
./manage.py runserver -
View the url and you will see the demo at webbrowser.
Development
-
Test Coverage
coverage run ./manage.py test
-
Test multiple django versions
tox
-
Show code quality
coverage xml python-codacy-coverage -r coverage.xml
Metadata
Release files for django-kindeditor 0.3.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| django-kindeditor-0.3.0.tar.gz | 519.5 kB | Without provenance | Details for django-kindeditor-0.3.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| django_kindeditor-0.3.0-py2.py3-none-any.whl | Python 3, Python 2 | none | any | Details for django_kindeditor-0.3.0-py2.py3-none-any.whl |
Total release size: 1.1 MB
Release files / django-kindeditor-0.3.0.tar.gz
| Download URL | django-kindeditor-0.3.0.tar.gz |
|---|---|
| Size | 519.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
fc4af907896df1a6e3176d5d671d88e9fa1632bad03ee78a6ae608ea047da776
|
|
BLAKE2b-256 checksum How to use checksums |
4b272d9dafe3ced55e069e870c2abde6987d28377ebf24c268afcad0ffb23e6c
|
| 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.3.0-py2.py3-none-any.whl
| Download URL | django_kindeditor-0.3.0-py2.py3-none-any.whl |
|---|---|
| Size | 594.2 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
e75f8ac1d004b607ad6d1b61833384cd2354c373c91bddd8a1ec6ff0d4136bb1
|
|
BLAKE2b-256 checksum How to use checksums |
4eaa338c2ea0463e7d9e71389e9d545cb24c9e5b5df5ea2a1ed5a5a2ae4a6312
|
| 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
|
Security for django-kindeditor 0.3.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.