From 030e8b75c3fe205bb5b8143590c838dd16924a41 Mon Sep 17 00:00:00 2001 From: Guillaume Pellerin Date: Thu, 10 Mar 2016 00:57:16 +0100 Subject: [PATCH] fix deprecated in 1.10 --- app/festival/urls.py | 5 ++--- app/sandbox/settings.py | 36 +++++++++++++++--------------------- app/sandbox/urls.py | 20 +++++++++++--------- 3 files changed, 28 insertions(+), 33 deletions(-) diff --git a/app/festival/urls.py b/app/festival/urls.py index ffed233f..686b4770 100644 --- a/app/festival/urls.py +++ b/app/festival/urls.py @@ -9,10 +9,9 @@ from mezzanine.conf import settings from festival.views import * -urlpatterns = patterns('', +urlpatterns = [ url(r'^artists/$', ArtistListView.as_view(), name="festival-artist-list"), url(r'^artists/(?P.*)/$', ArtistDetailView.as_view(), name="festival-artist-detail"), url(r'^videos/$', VideoListView.as_view(), name="festival-video-list"), url(r'^videos/(?P.*)/$', VideoDetailView.as_view(), name="festival-video-detail"), - -) +] diff --git a/app/sandbox/settings.py b/app/sandbox/settings.py index 0043e170..a0b6f7bd 100644 --- a/app/sandbox/settings.py +++ b/app/sandbox/settings.py @@ -186,12 +186,6 @@ MEDIA_ROOT = '/srv/media/' # Package/module name to import the root urlpatterns from for the project. ROOT_URLCONF = "%s.urls" % PROJECT_APP -# Put strings here, like "/home/html/django_templates" -# or "C:/www/django/templates". -# Always use forward slashes, even on Windows. -# Don't forget to use absolute paths, not relative paths. -TEMPLATE_DIRS = (os.path.join(PROJECT_ROOT, "templates"),) - ################ # APPLICATIONS # @@ -238,21 +232,21 @@ MODELTRANSLATION_TRANSLATION_FILES = ( 'translations', ) -# List of processors used by RequestContext to populate the context. -# Each one should be a callable that takes the request object as its -# only parameter and returns a dictionary to add to the context. -TEMPLATE_CONTEXT_PROCESSORS = ( - "django.contrib.auth.context_processors.auth", - "django.contrib.messages.context_processors.messages", - "django.core.context_processors.debug", - "django.core.context_processors.i18n", - "django.core.context_processors.static", - "django.core.context_processors.media", - "django.core.context_processors.request", - "django.core.context_processors.tz", - "mezzanine.conf.context_processors.settings", - "mezzanine.pages.context_processors.page", -) + +TEMPLATES = [{'APP_DIRS': True, + 'BACKEND': 'django.template.backends.django.DjangoTemplates', + 'DIRS': ('/srv/app/templates',), + 'OPTIONS': {'builtins': ['mezzanine.template.loader_tags'], + 'context_processors': ('django.contrib.auth.context_processors.auth', + 'django.contrib.messages.context_processors.messages', + 'django.core.context_processors.debug', + 'django.core.context_processors.i18n', + 'django.core.context_processors.static', + 'django.core.context_processors.media', + 'django.core.context_processors.request', + 'django.core.context_processors.tz', + 'mezzanine.conf.context_processors.settings', + 'mezzanine.pages.context_processors.page')}}] # List of middleware classes to use. Order is important; in the request phase, # these middleware classes will be applied in the order given, and in the diff --git a/app/sandbox/urls.py b/app/sandbox/urls.py index a5836b71..d253e00b 100644 --- a/app/sandbox/urls.py +++ b/app/sandbox/urls.py @@ -1,5 +1,6 @@ from __future__ import unicode_literals +import django.views.i18n from django.conf.urls import patterns, include, url from django.conf.urls.i18n import i18n_patterns from django.contrib import admin @@ -13,18 +14,19 @@ admin.autodiscover() # You can also change the ``home`` view to add your own functionality # to the project's homepage. -urlpatterns = i18n_patterns("", +urlpatterns = [ # Change the admin prefix here to use an alternate URL for the # admin interface, which would be marginally more secure. - ("^admin/", include(admin.site.urls)), -) + url("^admin/", include(admin.site.urls)), + ] if settings.USE_MODELTRANSLATION: - urlpatterns += patterns('', - url('^i18n/$', 'django.views.i18n.set_language', name='set_language'), - ) + urlpatterns += [ + url('^i18n/$', django.views.i18n.set_language, name='set_language'), + ] -urlpatterns += patterns('', + +urlpatterns += [ url(r'^festival/', include('festival.urls')), url("^%s/" % settings.EVENT_SLUG, include("mezzanine_agenda.urls")), @@ -79,7 +81,7 @@ urlpatterns += patterns('', # ``mezzanine.urls``, go right ahead and take the parts you want # from it, and use them directly below instead of using # ``mezzanine.urls``. - ("^", include("mezzanine.urls")), + url("^", include("mezzanine.urls")), # MOUNTING MEZZANINE UNDER A PREFIX # --------------------------------- @@ -96,7 +98,7 @@ urlpatterns += patterns('', # need to use the ``SITE_PREFIX`` setting as well. # ("^%s/" % settings.SITE_PREFIX, include("mezzanine.urls")) -) +] # Adds ``STATIC_URL`` to the context of error pages, so that error # pages can use JS, CSS and images. -- 2.39.5