diff mbox

[08/10] settings: Add TEMPLATES setting

Message ID 1452467279-14952-9-git-send-email-stephen.finucane@intel.com
State Accepted
Headers show

Commit Message

Stephen Finucane Jan. 10, 2016, 11:07 p.m. UTC
This was added in Django 1.8 and will be required by Django 1.10.

https://docs.djangoproject.com/en/1.9/ref/templates/upgrading/#the-templates-settings

Signed-off-by: Stephen Finucane <stephen.finucane@intel.com>
---
 patchwork/settings/base.py | 27 +++++++++++++++++++++++++--
 patchwork/settings/dev.py  |  5 ++++-
 2 files changed, 29 insertions(+), 3 deletions(-)

Comments

Stephen Finucane Jan. 19, 2016, 10:14 p.m. UTC | #1
On 10 Jan 23:07, Stephen Finucane wrote:
> This was added in Django 1.8 and will be required by Django 1.10.
> 
> https://docs.djangoproject.com/en/1.9/ref/templates/upgrading/#the-templates-settings
> 
> Signed-off-by: Stephen Finucane <stephen.finucane@intel.com>

Merged.
diff mbox

Patch

diff --git a/patchwork/settings/base.py b/patchwork/settings/base.py
index ae93622..5f51e47 100644
--- a/patchwork/settings/base.py
+++ b/patchwork/settings/base.py
@@ -61,9 +61,32 @@  ROOT_URLCONF = 'patchwork.urls'
 
 # Templates
 
-TEMPLATE_DIRS = (
+_TEMPLATE_DIRS = [
     os.path.join(ROOT_DIR, 'templates'),
-)
+]
+
+if django.VERSION >= (1, 8):
+    TEMPLATES = [
+        {
+            'BACKEND': 'django.template.backends.django.DjangoTemplates',
+            'DIRS': _TEMPLATE_DIRS,
+            'APP_DIRS': True,
+            'OPTIONS': {
+                'context_processors': [
+                    'django.contrib.auth.context_processors.auth',
+                    'django.template.context_processors.debug',
+                    'django.template.context_processors.i18n',
+                    'django.template.context_processors.media',
+                    'django.template.context_processors.static',
+                    'django.template.context_processors.tz',
+                    'django.contrib.messages.context_processors.messages',
+                ],
+            },
+        },
+    ]
+else:
+    TEMPLATE_DIRS = _TEMPLATE_DIRS
+
 
 # Email
 
diff --git a/patchwork/settings/dev.py b/patchwork/settings/dev.py
index 3ecdb06..20626c6 100644
--- a/patchwork/settings/dev.py
+++ b/patchwork/settings/dev.py
@@ -28,7 +28,10 @@  DEBUG = True
 
 # Templates
 
-TEMPLATE_DEBUG = True
+if django.VERSION < (1, 8):
+    # In Django 1.8+, this is only necessary if the value differs from
+    # the value for 'DEBUG'
+    TEMPLATE_DEBUG = True
 
 # Database