Commits

Anonymous committed 9e9e600

django CMS 2.4 compatibility

Comments (0)

Files changed (2)

semanticeditor/models.py

 from django.db import models
 from semanticeditor.fields import MultiSelectField
-from django.conf import settings
 
+# in django CMS 2.4, settings.CMS_TEMPLATE_INHERITANCE_MAGIC is unavailable
+try:
+    from django.conf import settings
+    template_list = [(f,n) for (f,n) in settings.CMS_TEMPLATES if f != settings.CMS_TEMPLATE_INHERITANCE_MAGIC]
 
-template_list = [(f,n) for (f,n) in settings.CMS_TEMPLATES if f != settings.CMS_TEMPLATE_INHERITANCE_MAGIC]
+except AttributeError:
+    import cms.constants
+    template_list = [(f,n) for (f,n) in settings.CMS_TEMPLATES if f != cms.constants.TEMPLATE_INHERITANCE_MAGIC]    
 
 
 class CssClassCategory(models.Model):

semanticeditor/views.py

 except ImportError:
     from django.utils.functional import wraps  # Python 2.3, 2.4 fallback.
 
+# in django CMS 2.4, settings.CMS_TEMPLATE_INHERITANCE_MAGIC is unavailable
+try:
+    TEMPLATE_INHERITANCE_MAGIC = settings.CMS_TEMPLATE_INHERITANCE_MAGIC
+except AttributeError:
+    import cms.constants
+    TEMPLATE_INHERITANCE_MAGIC = cms.constants.TEMPLATE_INHERITANCE_MAGIC
+
 
 def json_view(func):
     """
 def retrieve_styles(request):
     template = request.GET['template']
     page_id = request.GET['page_id']
-    if template == settings.CMS_TEMPLATE_INHERITANCE_MAGIC:
+    if template == TEMPLATE_INHERITANCE_MAGIC:
         # Need to look up page to find out what template to use
         p = Page.objects.get(pk=page_id)
         template = p.get_template()