mirror of
https://github.com/jazzband/django-dbtemplates.git
synced 2026-03-16 22:20:28 +00:00
commit
832b000c49
2 changed files with 16 additions and 0 deletions
|
|
@ -1,6 +1,7 @@
|
|||
import posixpath
|
||||
from django import forms
|
||||
from django.contrib import admin
|
||||
from django.core.exceptions import ImproperlyConfigured
|
||||
from django.utils.translation import ungettext, ugettext_lazy as _
|
||||
from django.utils.safestring import mark_safe
|
||||
|
||||
|
|
@ -59,6 +60,14 @@ if settings.DBTEMPLATES_AUTO_POPULATE_CONTENT:
|
|||
else:
|
||||
content_help_text = ""
|
||||
|
||||
if settings.DBTEMPLATES_USE_CODEMIRROR and settings.DBTEMPLATES_USE_TINYMCE:
|
||||
raise ImproperlyConfigured("You may use either CodeMirror or TinyMCE "
|
||||
"with dbtemplates, not both. Please disable one of them.")
|
||||
|
||||
if settings.DBTEMPLATES_USE_TINYMCE:
|
||||
from tinymce.widgets import AdminTinyMCE
|
||||
TemplateContentTextArea = AdminTinyMCE
|
||||
|
||||
|
||||
class TemplateAdminForm(forms.ModelForm):
|
||||
"""
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ from appconf import AppConf
|
|||
class DbTemplatesConf(AppConf):
|
||||
USE_CODEMIRROR = False
|
||||
USE_REVERSION = False
|
||||
USE_TINYMCE = False
|
||||
ADD_DEFAULT_SITE = True
|
||||
AUTO_POPULATE_CONTENT = True
|
||||
MEDIA_PREFIX = None
|
||||
|
|
@ -40,3 +41,9 @@ class DbTemplatesConf(AppConf):
|
|||
raise ImproperlyConfigured("Please add 'reversion' to your "
|
||||
"INSTALLED_APPS setting to make use of it in dbtemplates.")
|
||||
return value
|
||||
|
||||
def configure_use_tinymce(self, value):
|
||||
if value and 'tinymce' not in settings.INSTALLED_APPS:
|
||||
raise ImproperlyConfigured("Please add 'tinymce' to your "
|
||||
"INSTALLED_APPS setting to make use of it in dbtemplates.")
|
||||
return value
|
||||
|
|
|
|||
Loading…
Reference in a new issue