django-codemirror-widget is Django form widget library for using CodeMirror on textarea
Project description
Django form widget library for using CodeMirror on Textarea
Install
sudo pip install django-codemirror-widget
or
sudo pip install git+git://github.com/lambdalisue/django-codemirror-widget.git#egg=django-code-mirror
How to Use
First, you need to specified CODEMIRROR_PATH on settings.py. CODEMIRROR_PATH is the URI of CodeMirror directory like CODEMIRROR_PATH = r"javascript/codemirror". If you don’t specify it, it defaults to 'codemirror'. CodeMirror should be put there.
Use codemirror.widgets.CodeMirrorTextarea widgets for target Textarea like below:
from django import forms from codemirror.widgets import CodeMirrorTextarea codemirror = CodeMirrorTextarea(mode="python", theme="cobalt", config={ 'fixedGutter': True }) document = forms.TextField(widget=codemirror)
Settings
- CODEMIRROR_PATH
the URI of CodeMirror directory (your CodeMirror installation should live in {{ STATIC_URL }}/{{ CODEMIRROR_PATH }})
- CODEMIRROR_MODE
the default mode which may be a string or configuration map (DEFAULT: ‘javascript’)
- CODEMIRROR_THEME
the default theme applied (DEFAULT: ‘default’)
- CODEMIRROR_CONFIG
base mapping for the rest of the CodeMirror options (DEFAULT: { 'lineNumbers': True })
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Hashes for django-codemirror-widget-0.3.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2ebb7ccb863eeec1ac6bd3b2243287cfe237cfb37ebbeb4c8c026008544abe19 |
|
MD5 | f64c88751d58458b467a6db3e8cc9f91 |
|
BLAKE2b-256 | bd921744afca6cf9074fd659fc81370ca37335777398517bb1d090b5e941891e |