Support for using redactorjs for editing templates.

This commit is contained in:
Evan Culver 2012-09-05 14:27:55 -04:00
parent d2f595ce82
commit 2fc79eda7a
3 changed files with 12 additions and 1 deletions

View file

@ -20,4 +20,4 @@ The source code and issue tracker can be found on Github:
https://github.com/jezdez/django-dbtemplates
.. _template loader: http://docs.djangoproject.com/en/dev/ref/templates/api/#loader-types
.. _template loader: http://docs.djangoproject.com/en/dev/ref/templates/api/#loader-types

View file

@ -67,6 +67,10 @@ if settings.DBTEMPLATES_USE_CODEMIRROR and settings.DBTEMPLATES_USE_TINYMCE:
if settings.DBTEMPLATES_USE_TINYMCE:
from tinymce.widgets import AdminTinyMCE
TemplateContentTextArea = AdminTinyMCE
elif settings.DBTEMPLATES_USE_REDACTOR:
from redactor.widgets import RedactorEditor
TemplateContentTextArea = RedactorEditor
class TemplateAdminForm(forms.ModelForm):

View file

@ -10,6 +10,7 @@ class DbTemplatesConf(AppConf):
USE_CODEMIRROR = False
USE_REVERSION = False
USE_TINYMCE = False
USE_REDACTOR = False
ADD_DEFAULT_SITE = True
AUTO_POPULATE_CONTENT = True
MEDIA_PREFIX = None
@ -47,3 +48,9 @@ class DbTemplatesConf(AppConf):
raise ImproperlyConfigured("Please add 'tinymce' to your "
"INSTALLED_APPS setting to make use of it in dbtemplates.")
return value
def configure_use_redactor(self, value):
if value and 'redactor' not in settings.INSTALLED_APPS:
raise ImproperlyConfigured("Please add 'redactor' to your "
"INSTALLED_APPS setting to make use of it in dbtemplates.")
return value