def __init__(self, entity): try: self.template_name = get_template_name(entity) except NoSuchSetting as e: error = ("Couldn't render. " + "No setting called \"%s\" was found." % str(e)) error_page = get_changelist_url(Config) raise AccountsRedirect(error, url=error_page)
def get_template(self): try: return loader.get_template(self.template_name) except TemplateDoesNotExist: error = ("Couldn't render. " + "Template \"%s\" not found." % self.template_name) error_page = get_changelist_url(Template) raise AccountsRedirect(error, url=error_page) except TemplateSyntaxError as e: instance = Template.objects.get(name=self.template_name) error = "Couldn't render template. %s" % str(e) error_page = get_change_url(instance) raise AccountsRedirect(error, url=error_page)