From a691694a62c694714332ad41eb26c6c042e11beb Mon Sep 17 00:00:00 2001 From: Sanj Date: Sat, 10 Sep 2011 08:15:52 +0530 Subject: [PATCH] improve template not found debugging --- itf/app/models.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/itf/app/models.py b/itf/app/models.py index 09407e2..3ebfdb1 100644 --- a/itf/app/models.py +++ b/itf/app/models.py @@ -7,6 +7,7 @@ from django.core.paginator import Paginator, InvalidPage, EmptyPage from django.template.loader import render_to_string from django.contrib.contenttypes.models import ContentType from insidepages.models import ModuleTab, ModelExtra +from os.path import exists def splitSearch(string): ret = [] @@ -80,10 +81,14 @@ class ItfModel(models.Model): return self.get(self._get_fields().keys()) def insidepage_dict(self): + if not exists(self.get_template_path()): + return { + 'html': "Template for this model not found." + } try: html = render_to_string(self.get_template_path(), self.info_dict()) except: - html = "Template for this model not found." + html = "Template render error." return { 'url': self.get_absolute_url(), 'title': self.get_title(),