![PyPI Now Supports iOS and Android Wheels for Mobile Python Development](https://cdn.sanity.io/images/cgdhsj6q/production/96416c872705517a6a65ad9646ce3e7caef623a0-1024x1024.webp?w=400&fit=max&auto=format)
Security News
PyPI Now Supports iOS and Android Wheels for Mobile Python Development
PyPI now supports iOS and Android wheels, making it easier for Python developers to distribute mobile packages.
django-codemirror-widget
Advanced tools
.. image:: https://img.shields.io/pypi/v/django-codemirror-widget.svg :target: https://pypi.python.org/pypi/django-codemirror-widget/ :alt: Version
.. image:: https://img.shields.io/pypi/status/django-codemirror-widget.svg :target: https://pypi.python.org/pypi/django-codemirror-widget/ :alt: Status
.. image:: https://img.shields.io/pypi/l/django-codemirror-widget.svg :target: https://pypi.python.org/pypi/django-codemirror-widget/ :alt: License
.. image:: https://img.shields.io/pypi/pyversions/django-codemirror-widget.svg :target: https://pypi.python.org/pypi/django-codemirror-widget/ :alt: Python versions
Django <https://www.djangoproject.com>
_ form widget library for using CodeMirror <http://codemirror.net/>
_ on Textarea
.
.. code:: sh
pip install django-codemirror-widget
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.CodeMirrorTextarea
widget for target Textarea like below:
.. code:: python
from django import forms from codemirror import CodeMirrorTextarea
codemirror_widget = CodeMirrorTextarea( mode="python", theme="cobalt", config={ 'fixedGutter': True }, ) document = forms.TextField(widget=codemirror_widget)
Use the followings in your settings.py
.
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 }
)
CODEMIRROR_JS_VAR_FORMAT
A format string interpolated with the form field name to name a global JS variable that will hold the CodeMirror
editor object. For example with ``CODEMIRROR_JS_VAR_FORMAT = "%s_editor"`` and a field named 'code', the JS variable
name would be 'code_editor'. If ``CODEMIRROR_JS_VAR_FORMAT`` is None, no global variable is created (DEFAULT: None)
FAQs
Django form widget library for using CodeMirror on textarea
We found that django-codemirror-widget demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
PyPI now supports iOS and Android wheels, making it easier for Python developers to distribute mobile packages.
Security News
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.