Skip to main content

Intuitive text editing for humans using Django.

Project description

Join the chat at Get downloads at See latest build status at

Intuitive text editing for humans using Django.

This project is in early development, will change rapidly and most likely has bugs.


Install the package with pip.

$ pip install django-text

Add text to your installed packages.


    # ...

Add text.middleware.TextMiddleware and 'text.middleware.ToolbarMiddleware' to your middleware classes.


    # ...

Make sure these context processors are installed, they come with Django.


    # ...

Append text.urls to your urlpatterns in


from django.conf.urls import patterns, include, url

from text.urls import urlpatterns as django_text_patterns

urlpatterns = patterns('',
    url(r'^django_text/', include(django_text_patterns, namespace='django_text')),

Run migrate.

$ python migrate


The editable tag

Add editable tags to your templates.

<h1>{% editable "header" "My Header" %}</h1>

<div class="content">
    {% editable "text_body" %}

The editable tag takes a default text as the second argument. If no default text is passed, the name of the text node (i.e. the first argument) will be used if there is no corresponding text node in the database.

The blockeditable tag

You can also use the blockeditable tag that let’s you wrap content to use as the default text.

<div class="content">
        {% blockeditable "header" %}
            Read My Awesome Text
        {% endblockeditable %}

    {% blockeditable "content" %}
        Put your default text here!
    {% endblockeditable %}

The blockeditable tags works with translation tags inside of it. So if you already have a translated site, you can wrap your content with this tag and only add text nodes for some of the languages that you support.

Specifying content type

Both the editable and the blockeditable tags support specifying the content type of its default text.

{% editable "html_node" "<h1>Hello World!</h1>" "html" %}

{% blockeditable "markdown_node" "markdown" %}
# Hello there,

I can have markdown in my templates!
{% endblockeditable %}

If this is not provided both will default to raw text.

Content editing

The toolbar allows you to edit texts directly on your pages. The django-text toolbar

You can also edit texts in the Django Admin. django-text in Django Admin

Missing text nodes will be added to the database automatically when their template tags are rendered.



Default: True

Set to false to disable django-text from adding missing text nodes to the database.


Default: True

Set to false to disable the toolbar interface.


Default: 'djtext_form'

This is passed to the toolbar form and can be changed to avoid name conflicts.


Default: True

Set to false to disable instant updating of the DOM when saving texts in the toolbar.


Default: ('<span data-text-name="{0}" class="{1}">', '</span>')

A tuple of two that gets wrapped around texts in the template to enable instant updating.


Default: 'dj_text_inline_wrapper'

Change this to change the class of the element that gets wrapped around texts.


Contribution is very welcome. Use issues to report bugs and propose features.


Copyright (c) 2015 Anton Agestam. django-text is released under the MIT license. See the LICENSE file for more information and licenses for bundled code.

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django-text-1.5.6.tar.gz (64.7 kB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page