while updating a feincms project to Django 1.8 (LTS), all stuff using
TemplateContent content type broke. Django 1.8 uses a new template code to allow for
various templating engines, which is not compatible with latest feincms (1.11.4).
I tried to fix it, and got a working solution, albeit somewhat patchy
and not very thoroughly tested. If anyone has this problem, feel free to
use the patch as a starting point. One could insert a django version detection to choose code variants, but I did not need this (it is a quick patch after all).
BTW, I think future versions of FeinCMS will use Djangos new templating
code, so this patch will become obsolete for newer installations.
The file to patch is feincms/content/template/models.py; see the code changes and the complete file (as attachment):
try:
# the old version:
from django.template.loader import (
Context, Template, TemplateDoesNotExist, find_template_loader)
except ImportError:
from django.template import Context, Template
from django.template.loader import TemplateDoesNotExist
from django.template.engine import Engine
# ...
@classmethod
def initialize_type(cls, TEMPLATE_LOADERS=DEFAULT_TEMPLATE_LOADERS,
TEMPLATE_PATH='content/template'):
cls.template_path = TEMPLATE_PATH
engine = Engine() # account for the new template engine in Django 1.8
for loader in TEMPLATE_LOADERS:
if loader:
# With Django 1.6 find_template_loader blows up during
# syncdb, probably because component initialization order
# has changed. Work around by ignoring exceptions here,
# but of course, this will also swallow legitimate
# exceptions. Tough luck :-(
try:
# was: cls.template_loaders.append(find_template_loader(loader))
cls.template_loaders.append(engine.find_template_loader(loader))
except Exception:
pass