1
0
mirror of https://github.com/django/django.git synced 2025-10-24 22:26:08 +00:00

Removed direct references to template-related settings.

This commit is contained in:
Aymeric Augustin
2014-11-22 21:43:13 +01:00
parent 6294bd3903
commit 18533fb558
3 changed files with 10 additions and 6 deletions

View File

@@ -13,6 +13,7 @@ from django.core.exceptions import ViewDoesNotExist
from django.http import Http404
from django.core import urlresolvers
from django.contrib.admindocs import utils
from django.template.engine import Engine
from django.utils.decorators import method_decorator
from django.utils._os import upath
from django.utils import six
@@ -291,13 +292,13 @@ class TemplateDetailView(BaseAdminDocsView):
def get_context_data(self, **kwargs):
template = self.kwargs['template']
templates = []
for dir in settings.TEMPLATE_DIRS:
for dir in Engine.get_default().dirs:
template_file = os.path.join(dir, template)
templates.append({
'file': template_file,
'exists': os.path.exists(template_file),
'contents': lambda: open(template_file).read() if os.path.exists(template_file) else '',
'order': list(settings.TEMPLATE_DIRS).index(dir),
'order': list(Engine.get_default().dirs).index(dir),
})
kwargs.update({
'name': template,