misc: only expose existing templates in styles demo page (#22439)
This commit is contained in:
parent
3e52deedae
commit
0cce0da6ab
|
@ -29,6 +29,7 @@ from django.http import (Http404, HttpResponse, HttpResponseRedirect,
|
|||
HttpResponsePermanentRedirect)
|
||||
from django.shortcuts import render, resolve_url
|
||||
from django.template import engines
|
||||
from django.template.loader import get_template, TemplateDoesNotExist
|
||||
from django.utils import lorem_ipsum, timezone
|
||||
from django.views.decorators.csrf import csrf_exempt
|
||||
|
||||
|
@ -275,6 +276,11 @@ class StyleDemoPage(object):
|
|||
cell = TextCell(page=self.page, placeholder=placeholder.key, order=1)
|
||||
options_html = []
|
||||
for template_key, template_dict in settings.COMBO_PUBLIC_TEMPLATES.items():
|
||||
try:
|
||||
get_template(template_dict.get('template'))
|
||||
except TemplateDoesNotExist:
|
||||
# don't propose templates that do not exist
|
||||
continue
|
||||
attr = 'value="%s"' % template_key
|
||||
if template_key == self.page.template_name:
|
||||
attr += ' selected="selected"'
|
||||
|
|
Loading…
Reference in New Issue