Skip to main content

Django TinyMCE Editor

Add a TinyMCE rich text editor to Django forms. The widget works with Django's default admin and Django Daisy. The app has no database models or migrations.

Installation

pip install .

Add "django_tinymce_editor" to INSTALLED_APPS. The package includes the TinyMCE 8.10.2 Community distribution, including its plugins, skins, and themes. Django serves these through its staticfiles app.

The bundled editor defaults to TINYMCE_EDITOR_LICENSE_KEY = "gpl" for use under GPLv2+. For a commercial deployment, configure a valid self-hosted license key and install the license key manager as described by TinyMCE.

For deployment, run collectstatic and serve the original filenames alongside any hashed copies, because TinyMCE loads its plugins and skins dynamically. Set TINYMCE_EDITOR_SCRIPT to use a separate self-hosted build. Set TINYMCE_EDITOR_LICENSE_KEY = "" to render a plain textarea.

The Django integration is MIT-licensed. The bundled TinyMCE distribution has its own license and third-party notices. The corresponding upstream code is available in the TinyMCE 8.10.2 source tree.

Edit an existing field in the admin

Use the same ModelAdmin setup with either admin site. Replace Article and body with your model and existing text field.

from django import forms
from django.contrib import admin
from django_tinymce_editor.fields import TinyMCEWidget

from .models import Article


class ArticleAdminForm(forms.ModelForm):
    class Meta:
        model = Article
        fields = "__all__"
        widgets = {"body": TinyMCEWidget}


@admin.register(Article)
class ArticleAdmin(admin.ModelAdmin):
    form = ArticleAdminForm

For a regular form, use forms.CharField(widget=TinyMCEWidget) and include {{ form.media }} and {% csrf_token %} in your template. If you prefer to declare the editor on a model in your own app, use django_tinymce_editor.fields.TinyMCEField, a TextField subclass whose default form widget is the editor.

TinyMCE stores HTML. Sanitize untrusted HTML on the server before rendering it, including content submitted directly to the form.

Paste Markdown

Paste Markdown as plain text with Ctrl+Shift+V or Cmd+Shift+V. Markdown headings, lists, links, and other formatting are converted into editable content and saved as HTML. Plain text without Markdown formatting and clipboard content that already contains rich HTML use TinyMCE's normal paste. The package bundles markdown-it 15.0.3 under its MIT license.

Enable image uploads

Include the editor's URL configuration in your project's URL patterns.

from django.urls import include, path

urlpatterns = [
    # Your existing URLs
    path("editor/", include("django_tinymce_editor.urls")),
]

Staff users can upload an image from the Upload tab in TinyMCE's image dialog. The routes use Django's session and authentication middleware and require an active staff account. Uploads and deletions require a CSRF token. The size limit defaults to 5 MiB and can be set in bytes with TINYMCE_EDITOR_MAX_UPLOAD_SIZE.

The editor uses Django's default file storage. The attachment API still lets staff list and delete their own uploads. Listing requires storage with listdir() support. Files stay in storage until explicitly deleted.

Production security

  • Rich text. Apply a server-side HTML allowlist before rendering untrusted editor content as HTML. Allow only the elements, attributes, and URL schemes your application needs. Apply this rule to every rendering path, including admin previews. TinyMCE filters content in the browser, and requests can submit HTML directly to Django. See the TinyMCE security guide.
  • Media hosting. Keep the optional attachment routes disabled until your media service is configured. Serve uploads from a separate registrable domain, set explicit content types and X-Content-Type-Options: nosniff, and serve documents and archives as downloads. The package checks file signatures and extensions. Add deeper validation or scanning where your file policy requires it. See Django's upload guidance.
  • Private attachments. Staff and owner checks apply to upload, list, and delete operations. The editor inserts the storage URL into saved HTML. Public URLs can be shared, and signed URLs can expire. For private files, use a stable download URL that checks the requesting user's access to the associated content before serving the file or issuing a fresh signed URL.
  • Upload limits. Configure a request-body limit at the reverse proxy, with room for multipart overhead. The package's file-size limit runs after Django parses the upload. Set rate limits and storage quotas as needed. Each list request reads the owner's full storage directory before returning a page, so verify listing performance at your expected attachment volume.
  • Dependencies. Deploy on a supported Django release and keep the bundled TinyMCE runtime or your custom build up to date. Track the TinyMCE changelog for security updates. Before rollout, verify TinyMCE loads under your production Content Security Policy and check upload and download behavior with the actual proxy and storage backend.

Run the tests

After installing this project locally, run python -m django test --settings=tests.settings from the repository root. With Django Daisy installed, run the same command with --settings=tests.settings_daisy to verify that admin too.

Publish a release

Configure a PyPI Trusted Publisher for project django-tinymce-editor, GitHub owner django-daisy, repository tinymce-editor, workflow publish.yml, and environment pypi. Use a pending publisher for the first release.

Push a Git tag matching the version in pyproject.toml, for example v0.1.1 for version 0.1.1. GitHub Actions runs the tests, builds and checks the wheel and source distribution, then uploads both to PyPI.

To publish an existing tag, open Actions → Publish to PyPI → Run workflow on GitHub and enter the tag in release_tag.

Metadata

Release files for django-tinymce-editor 0.1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for django-tinymce-editor 0.1.2
File Size Uploaded Provenance Actions
django_tinymce_editor-0.1.2.tar.gz 2.7 MB With provenance Details for django_tinymce_editor-0.1.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for django-tinymce-editor 0.1.2
File Interpreter ABI Platform Actions
django_tinymce_editor-0.1.2-py3-none-any.whl Python 3 none any Details for django_tinymce_editor-0.1.2-py3-none-any.whl

Total release size: 5.5 MB

Release files / django_tinymce_editor-0.1.2.tar.gz

Download URL django_tinymce_editor-0.1.2.tar.gz
Size 2.7 MB
Tags Source
SHA-256 checksum
How to use checksums
aa7b5dae504518c4bee4bdd456b6cf4b0be5bf0ad0f477381bd3904ea2220073
BLAKE2b-256 checksum
How to use checksums
19b411233edabcc31960c20d2d07b0e2d46897f7d199cd6d27197772ba8e45cd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 23, 2026.

Transparency log

Release files / django_tinymce_editor-0.1.2-py3-none-any.whl

Download URL django_tinymce_editor-0.1.2-py3-none-any.whl
Size 2.8 MB
Tags Python 3
SHA-256 checksum
How to use checksums
c0e603a5f39393406c5d6b27cf89895b8449fd1e4f29fa1b192c52bc0d162ec4
BLAKE2b-256 checksum
How to use checksums
da3152aa0f1989eda34ffb89a0363ed08353be46a6fec933836adba6f5bcc1ab
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 23, 2026.

Transparency log

Security for django-tinymce-editor 0.1.2

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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for django_tinymce_editor-0.1.2.tar.gz

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 Nov 23, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.2 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page