diff --git a/README.rst b/README.rst index e0e9977..2554ecb 100644 --- a/README.rst +++ b/README.rst @@ -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 \ No newline at end of file +.. _template loader: http://docs.djangoproject.com/en/dev/ref/templates/api/#loader-types diff --git a/dbtemplates/admin.py b/dbtemplates/admin.py index 9505d26..de66f44 100644 --- a/dbtemplates/admin.py +++ b/dbtemplates/admin.py @@ -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): diff --git a/dbtemplates/conf.py b/dbtemplates/conf.py index 0bcf4ec..62111a6 100644 --- a/dbtemplates/conf.py +++ b/dbtemplates/conf.py @@ -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