All Projects → pi-dal → django-vditor

pi-dal / django-vditor

Licence: MIT license
A WYSIWYG editor plugin made by vditor for django

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to django-vditor

wnpp.debian.net
🌍 Code powering website "Debian Packages that Need Lovin'" created in 2009
Stars: ✭ 38 (+171.43%)
Mutual labels:  django-application
typora-hivacruz-theme
A Typora theme forked from Cobalt to match my other color schemes.
Stars: ✭ 38 (+171.43%)
Mutual labels:  wysiwyg
django-munigeo
Reusable Django application for storing and accessing municipality-related geospatial data
Stars: ✭ 12 (-14.29%)
Mutual labels:  django-application
striven-editor
The editor used in the Striven ERP system.
Stars: ✭ 14 (+0%)
Mutual labels:  wysiwyg
djadmin
Djadmin is a django admin theme
Stars: ✭ 42 (+200%)
Mutual labels:  django-application
django-social-network-like-Facebook-or-Instagram
Live site at https://sbraven.herokuapp.com Do checkout this project to know how all the features of Facebook like Like , Comments , Messaging , Profile, Stories, Notifications , Friend Requests work under the hood.
Stars: ✭ 19 (+35.71%)
Mutual labels:  django-application
Django-WebApp
This is a web-app created using Python, Django. By using this user can login, upload files and also can view and download files uploaded by other users.
Stars: ✭ 285 (+1935.71%)
Mutual labels:  django-application
drf-addons
Some customised Django classes and functions that one can use in DJango. Collected from internet!
Stars: ✭ 20 (+42.86%)
Mutual labels:  django-application
django-neumorphism-uikit
Django Web App - Neumorphism UI Kit | AppSeed
Stars: ✭ 19 (+35.71%)
Mutual labels:  django-application
meteor-editable-text-wysiwyg-bootstrap-3
WYSIWYG extension for babrahams:editable-text package for bootstrap-3 apps
Stars: ✭ 18 (+28.57%)
Mutual labels:  wysiwyg
svelte-slate
slate svelte view layer
Stars: ✭ 43 (+207.14%)
Mutual labels:  wysiwyg
lets-quiz
A quiz website for organizing online quizzes and tests. It's build using Python/Django and Bootstrap4 frameworks. 🤖
Stars: ✭ 165 (+1078.57%)
Mutual labels:  django-application
django-mapbox-location-field
Simple in use location model and form field with MapInput widget for picking some location. Uses mapbox gl js, flexible map provider API. Fully compatible with bootstrap framework. Can be used with spatial or plain databases.
Stars: ✭ 60 (+328.57%)
Mutual labels:  django-application
arma-dialog-creator
A dialog/GUI creation tool for Arma 3.
Stars: ✭ 73 (+421.43%)
Mutual labels:  wysiwyg
vimana-framework
Vimana is an experimental security framework that aims to provide resources for auditing Python web applications.
Stars: ✭ 47 (+235.71%)
Mutual labels:  django-application
djaq
Django queries
Stars: ✭ 54 (+285.71%)
Mutual labels:  django-application
kasir
Cashier Management & Inventory Management System
Stars: ✭ 28 (+100%)
Mutual labels:  django-application
Bistu
集成了 django-simpleui 作为 admin 管理主题,实现的一个小型的管理系统,并且有的 django-rest-framework 使用示例。此外有个 Bistu-Ant-Design-Pro 项目作为配套的前端使用。如果喜欢记得给个🌟star哦。
Stars: ✭ 51 (+264.29%)
Mutual labels:  django-application
matchering-web
🎚️ Self-Hosted LANDR / eMastered Alternative
Stars: ✭ 25 (+78.57%)
Mutual labels:  django-application
Briefly
source based news in short : Winner @MumbaiHackathon 2018
Stars: ✭ 35 (+150%)
Mutual labels:  django-application

django-vditor

django-vditor is Markdown Editor plugin application for django base on vditor.
django-vditor was inspired by great django-mdeditor.

python-version django-version


Features

  • Almost Vditor features
    • Support three editing modes: what you see is what you get (wysiwyg), instant rendering (ir), split screen preview (sv)
    • Support outline, mathematical formulas, brain maps, charts, flowcharts, Gantt charts, timing charts, staff, multimedia, voice reading, title anchors, code highlighting and copying, graphviz rendering
    • Built-in security filtering, export, task list, multi-platform preview, multi-theme switching, copy to WeChat official account/Zhuhu function
    • Implement CommonMark and GFM specifications, format Markdown and view syntax tree, and support 10+ configurations
    • The toolbar contains 36+ operations. In addition to supporting extensions, you can customize the shortcut keys, prompts, prompt locations, icons, click events, class names, and sub-toolbars in each item.
    • You can use drag and drop, clipboard to paste upload, display real-time upload progress, and support CORS cross-domain upload
    • Pasted HTML is automatically converted to Markdown. If the pasted includes external link pictures, it can be uploaded to the server through the designated interface
    • Support main window size drag and drop, character count
    • Multi-theme support, built-in three sets of black and white themes
    • Multi-language support, built-in Chinese, English, and Korean text localization
    • Support mainstream browsers, friendly to mobile
  • The VditorTextField field is provided for the model and can be displayed directly in the django admin.
  • The VditorTextFormField is provided for the Form and ModelForm.
  • The VditorWidget is provided for the Admin custom widget.

Quick start

  • Installation.
    # pip
    pip install django-vditor
    # pipenv
    pipenv install django-vditor
    # poetry
    poetry add django-vditor
    # pdm
    pdm add django-vditor
  • Add vditor to your INSTALLED_APPS setting like this:
    INSTALLED_APPS = [
        ...
        'vditor',
    ]
  • add frame settings for django3.0+ like this:
X_FRAME_OPTIONS = 'SAMEORIGIN'
  • Add 'media' url to your settings like this:
MEDIA_ROOT = os.path.join(BASE_DIR, 'uploads')
MEDIA_URL = '/media/'
  • Add url to your urls like this:
from django.conf.urls import url, include
from django.conf.urls.static import static
from django.conf import settings
...

urlpatterns = [
    ...
    path('vditor/', include('vditor.urls'))
]

if settings.DEBUG:
    urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
  • Write your models like this:
from django.db import models
from vditor.fields import VditorTextField

class ExampleModel(models.Model):
    name = models.CharField(max_length=10)
    content = VditorTextField()
  • Register your model in admin.py
  • Run python manage.py makemigrations and python manage.py migrate to create your models.
  • Login Admin ,you can see a markdown editor text field like this:

django-vditor

Usage

Edit fields in the model using Markdown

Using Markdown to edit the fields in the model, we simply replace the TextField of the model with VditorTextField.

from django.db import models
from vditor.fields import VditorTextField

class ExampleModel(models.Model):
    name = models.CharField(max_length = 10)
    content = VditorTextField()

Admin in the background, will automatically display markdown edit rich text.

Used in front-end template, you can use like this:

{% load static %}
<! DOCTYPE html>
<html lang = "en">
    <head>
        <meta http-equiv = "Content-Type" content = "text/html; charset = utf-8" />
    </head>
    <body>
        <form method = "post" action = "./">
            {% csrf_token %}
            {{ form.media }}
            <ul style="display: flex">
                {{ form.as_p }}
            </ul>
            <p> <input type = "submit" value = "post"> </p>
        </form>
    </body>
</html>

Edit fields in the Form using markdown

Use markdown to edit fields in the Form, use VditorTextFormField instead of forms.CharField, as follows:

from vditor.fields import VditorTextFormField

class VditorForm(forms.Form):
    name = forms.CharField()
    content = VditorTextFormField()

ModelForm can automatically convert the corresponding model field to the form field, which can be used normally:

class VditorModleForm(forms.ModelForm):

    class Meta:
        model = ExampleModel
        fields = '__all__'

Use the markdown widget in admin

Use the markdown widget in admin like as :

from django.contrib import admin
from django.db import models

# Register your models here.
from. import models as demo_models
from vditor.widgets import VditorWidget


class ExampleModelAdmin(admin.ModelAdmin):
    formfield_overrides = {
        models.TextField: {'widget': VditorWidget}
    }


admin.site.register(demo_models.ExampleModel, ExampleModelAdmin)

Customize the toolbar

Add the following configuration to settings:

VDITOR_CONFIGS = { # remember to write "' '"
  'default':{
      "width": "%90", # use numbers or percentages
      "height": 360, # use numbers
      "preview_theme": "light", # can fill in dark, light, wechat
      "typewriterMode": "True", # whether to enable typewriter mode
      "mode": "ir", # optional modes: sv, ir, wysiwyg
      "debugger": "false", # whether to show log
      "value": "", # editor initialization value
      "theme": "classic", # can fill in classic, dark
      "icon": "ant", # canfill in ant, material
      "outline": "false", # show outline
  }
}

Reference

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].