django-codemirror-editor
A Django widget that integrates CodeMirror 6 into Django forms and admin as a drop-in replacement for standard textarea fields.
Features
- CodeMirrorWidget - Form widget that renders textareas with CodeMirror 6
- AdminCodeMirrorWidget - Specialized widget with admin-specific styling
- CodeMirrorField - Model field (
TextField) that automatically uses CodeMirror in forms - Language support - HTML, CSS, and JavaScript syntax highlighting
- Formset support - Works with Django admin inlines and dynamically added forms
- content-editor plugin - Integrates with django-content-editor activation/deactivation events
Requirements
- Python 3.10+
- Django 4.2+
Installation
pip install django-codemirror-editor
Add to your INSTALLED_APPS:
INSTALLED_APPS = [
...
'codemirror_editor',
]
Quick Start
In a Model
from django.db import models
from codemirror_editor.fields import CodeMirrorField
class Snippet(models.Model):
code = CodeMirrorField(language='javascript')
In a Form
from django import forms
from codemirror_editor.widgets import CodeMirrorWidget
class SnippetForm(forms.Form):
code = forms.CharField(widget=CodeMirrorWidget(language='html'))
In Django Admin
from django.contrib import admin
from codemirror_editor.widgets import AdminCodeMirrorWidget
class SnippetAdmin(admin.ModelAdmin):
formfield_overrides = {
models.TextField: {'widget': AdminCodeMirrorWidget(language='css')},
}
Configuration
The language parameter accepts: 'html', 'css', or 'javascript'.
Disclaimer
This project is not affiliated with, endorsed by, or associated with CodeMirror or its maintainers. It is an independent, third-party Django integration that bundles the CodeMirror 6 editor library.
License
MIT License - see LICENSE for details.
Metadata
Release files for django-codemirror-editor 0.1.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 | |
|---|---|---|---|
| django_codemirror_editor-0.1.0.tar.gz | 3.9 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| django_codemirror_editor-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 8.7 kB
Release files / django_codemirror_editor-0.1.0.tar.gz
| Download URL | django_codemirror_editor-0.1.0.tar.gz |
|---|---|
| Size | 3.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
1fadb5881b6e61ff90d777078611d8818f6d6f4920c76311509f87c699c8e481
|
|
BLAKE2b-256 checksum How to use checksums |
9ba164fa767eb73c4565b5f26a72e19bc9bac760335e8b07a035db432e766a21
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Apr 3, 2026.
Transparency logRelease files / django_codemirror_editor-0.1.0-py3-none-any.whl
| Download URL | django_codemirror_editor-0.1.0-py3-none-any.whl |
|---|---|
| Size | 4.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
b46fc9d64fc0d2ecb3ee1cbe10a49fea5f234c15f7588d7aa04b09264f89f018
|
|
BLAKE2b-256 checksum How to use checksums |
adafddf98dce3435cc7e386a6074ffb704ec315d9dff94ac56f1925d505a414a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Apr 3, 2026.
Transparency log