Django integration for Vditor Markdown Editor
Project description
dj_vditor
Django integration for Vditor Markdown Editor
Installation
pip install dj_vditor
# 如果需要OSS支持
pip install dj_vditor[oss]
Quick Start
- Add to
INSTALLED_APPS:
INSTALLED_APPS = [
...
'dj_vditor',
]
- Add URL route in
urls.py:
# 当然你也可以自定义url和view, 只要跟配置中的upload.url一致即可
urlpatterns = [
...
path('vditor/', include('dj_vditor.urls')),
]
- Use in Model:
from dj_vditor.models import VditorTextField
class Article(models.Model):
content = VditorTextField(config_name="my_config")
- Configure settings:
# 这是默认配置, 如果不需要修改的话, 可以不设置, 直接使用默认配置
VDITOR_CONFIGS = {
"width": "100%",
"height": 720,
"cache": {"enable": False},
"mode": "sv",
"debugger": "false",
"icon": "ant",
"outline": "",
"counter": {
"enable": True,
},
"lang": "zh_CN",
"toolbar": [
"emoji",
"headings",
"bold",
"italic",
"strike",
"link",
"|",
"list",
"ordered-list",
"check",
"outdent",
"indent",
"|",
"quote",
"line",
"code",
"inline-code",
"insert-after",
"table",
"|",
"upload",
"fullscreen",
"export",
"|",
"outline",
],
"upload": {
"url": "/vditor-upload/", # 上传接口地址
"max": 5 * 1024 * 1024, # 5MB
"accept": "image/png,image/jpeg,image/gif,image/webp", # 允许类型
"fieldName": "file[]",
"multiple": True,
},
}
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
dj_vditor-0.1.0.tar.gz
(4.1 MB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file dj_vditor-0.1.0.tar.gz.
File metadata
- Download URL: dj_vditor-0.1.0.tar.gz
- Upload date:
- Size: 4.1 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
57e7c724c736ba466edb2bbfa3a5cfea011cd6b2c23823886f92a4ef2b935119
|
|
| MD5 |
d1656926ce45fe963e345b429eaac825
|
|
| BLAKE2b-256 |
ed22da8a4d0eb8d4b19e91a98a63ee8f0883bcc85c1c4db18e1160b6d64500e9
|
File details
Details for the file dj_vditor-0.1.0-py3-none-any.whl.
File metadata
- Download URL: dj_vditor-0.1.0-py3-none-any.whl
- Upload date:
- Size: 3.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f9bbc38a82aa1d495285184da0244360c28392fb1f43c8010bc92fc7a24dca67
|
|
| MD5 |
df014656bfbe85301181554e11935ef2
|
|
| BLAKE2b-256 |
4a480b2b076c4a5bc93e2c6aba92666f41a2a4a6089300b5ca3f55d78b912961
|