Package: django-text
Intuitive text editing for humans using Django.This project is in early development, please test it out and report any bugs!InstallationInstall the package with pip.$pipinstalldjango-textAddtextto your installed packages.# settings.pyINSTALLED_APPS=(# ...'text',)Addtext.middleware.TextMiddlewareand'text.middleware.ToolbarMiddleware'to your middleware classes.# settings.pyMIDDLEWARE_CLASSES=(# ...'text.middleware.TextMiddleware','text.middleware.ToolbarMiddleware',)Make sure these context processors are installed, they come with Django.# settings.pyTEMPLATE_CONTEXT_PROCESSORS=(# ...'django.contrib.auth.context_processors.auth','django.core.context_processors.request',)Appendtext.urlsto your urlpatterns inurls.py.# urls.pyfromdjango.conf.urlsimportpatterns,include,urlfromtext.urlsimporturlpatternsasdjango_text_patternsurlpatterns=patterns('',url(r'^django_text/',include(django_text_patterns,namespace='django_text')),)Runmigrate.$pythonmanage.pymigrateUsageThetexttagAddeditabletags to your templates.{% load text %}<h1>{% text "header" "My Header" %}</h1><divclass="content">{% text "text_body" %}</div>Thetexttag 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.TheblocktexttagYou can also use theblocktexttag that let’s you wrap content
to use as the default text.{% load text %}<divclass="content"><h1>{% blocktext "header" %}
            Read My Awesome Text
        {% endblocktext %}</h1>{% blocktext "content" %}
        Put your default text here!
    {% endblocktext %}</div>Theblocktexttags 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 typeBoth thetextand theblocktexttags support specifying
the content type of its default text. The choices are“html”,“markdown”and“text”which is the default.{% text "html_node" "<h1>Hello World!</h1>" "html" %}

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

I can have markdown in my templates!
{% endblocktext %}If content type is not provided both will default to text.Disable instant updatingBy default the templatetags will wrap all text nodes with a span
element to enable “instant updating”, ifTEXT_TOOLBAR_INSTANT_UPDATEis set toTrue. Sometimes this
can cause trouble, for instance when you want to have editable
texts inside<title>or<meta>elements.You can disable instant updating on per-node basis by setting the
templatetag keyword argumentinstant_updatetoFalse:<title>{% text "title" "Welcome!" instant_update=False %}</title><title>{% blocktext "block_title" instant_update=False %}
    Welcome one, welcome all!
    {% endblocktext %}</title>Content editingThe toolbar allows you to edit texts directly on your pages if you’re
signed in as staff and have the permission'text.change_text'or if
you’re signed is as a superuser.Missing text nodes will be added to the database automatically when
their template tags are rendered.SettingsAUTOPOPULATE_TEXTDefault:TrueSet to false to disable django-text from adding missing text nodes to
the database.TEXT_TOOLBAR_ENABLEDDefault:TrueSet to false to disable the toolbar interface.TEXT_TOOLBAR_FORM_PREFIXDefault:'djtext_form'This is passed to the toolbar form and can be changed to avoid name
conflicts.TEXT_TOOLBAR_INSTANT_UPDATEDefault:TrueSet to false to disable instant updating of the DOM when saving texts in
the toolbar.TEXT_INLINE_WRAPPERDefault:('<spandata-text-name="{0}"class="{1}">','</span>')A tuple of two that gets wrapped around texts in the template to enable
instant updating.TEXT_INLINE_WRAPPER_CLASSDefault:'dj_text_inline_wrapper'Change this to change the class of the element that gets wrapped around
texts.ContributionContribution is very welcome. Useissuesto
report bugs and propose features. For pull requests to be accepted
they need to be well tested.Running testsInstall test dependencies.$brewinstallphantomjs$pipinstall-rtest-requirements.txtRun tests.$maketestRun tests with coverage.$maketest-coverageLicenseCopyright (c) 2015 Anton Agestam. django-text is released under the MIT
license. See the LICENSE file for more information and licenses for
bundled code.