improve template not found debugging
This commit is contained in:
parent
8b132b029e
commit
a691694a62
|
@ -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(),
|
||||
|
|
Loading…
Reference in New Issue
Block a user