From 724466618bfe0781124b65718acaf029d32ea912 Mon Sep 17 00:00:00 2001 From: bkfox Date: Thu, 17 Aug 2017 16:33:11 +0200 Subject: [PATCH] fix templatemixin --- aircox_cms/template.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/aircox_cms/template.py b/aircox_cms/template.py index 0c24059..3fa8f50 100644 --- a/aircox_cms/template.py +++ b/aircox_cms/template.py @@ -11,7 +11,6 @@ class TemplateMixinMeta(models.base.ModelBase): one, and throw error if there is an error in the template. """ def __new__(cls, name, bases, attrs): - from django.template.loader import get_template from django.template import TemplateDoesNotExist cl = super().__new__(cls, name, bases, attrs) @@ -26,9 +25,11 @@ class TemplateMixinMeta(models.base.ModelBase): ) if name != 'SectionItem': try: + from django.template.loader import get_template get_template(cl.template) - except TemplateDoesNotExist: + except (TemplateDoesNotExist, InvalidTemplateLirary) as e: cl.template = 'aircox_cms/sections/section_item.html' + print('TemplateMixin error:', e) return cl