From 3fc1cd946348bebbeb09fa21c4adcedaccac9809 Mon Sep 17 00:00:00 2001 From: Andrii Marynets Date: Wed, 19 Jul 2017 00:39:52 +0300 Subject: [PATCH] Fix url which will be deprecated in Django 1.10 --- digitalglarus/urls.py | 3 ++- dynamicweb/urls.py | 14 +++++++------- hosting/urls.py | 3 ++- nosystemd/urls.py | 3 ++- 4 files changed, 13 insertions(+), 10 deletions(-) diff --git a/digitalglarus/urls.py b/digitalglarus/urls.py index eba9896e..92cd8e11 100644 --- a/digitalglarus/urls.py +++ b/digitalglarus/urls.py @@ -1,5 +1,6 @@ from django.conf.urls import url from django.utils.translation import ugettext_lazy as _ +from django.contrib.auth import views as auth_views from . import views from .views import ContactView, IndexView, HistoryView, LoginView, SignupView,\ @@ -20,7 +21,7 @@ urlpatterns = [ url(_(r'contact/?$'), ContactView.as_view(), name='contact'), url(_(r'login/?$'), LoginView.as_view(), name='login'), url(_(r'signup/?$'), SignupView.as_view(), name='signup'), - url(r'^logout/?$', 'django.contrib.auth.views.logout', + url(r'^logout/?$', auth_views.logout, {'next_page': '/digitalglarus/login?logged_out=true'}, name='logout'), url(r'reset-password/?$', PasswordResetView.as_view(), name='reset_password'), url(r'reset-password-confirm/(?P[0-9A-Za-z]+)-(?P.+)/$', diff --git a/dynamicweb/urls.py b/dynamicweb/urls.py index 45b6d2d9..ad286317 100644 --- a/dynamicweb/urls.py +++ b/dynamicweb/urls.py @@ -1,8 +1,8 @@ from django.conf.urls import patterns, include, url from django.contrib import admin -# deprecated in version 1.8 from django.conf.urls.i18n import i18n_patterns from django.conf.urls.static import static +from django.views import i18n, static as static_view from django.conf import settings from hosting.views import RailsHostingView, DjangoHostingView, NodeJSHostingView @@ -22,11 +22,11 @@ urlpatterns = [url(r'^index.html$', LandingView.as_view()), url(r'^nosystemd/', include('nosystemd.urls', namespace="nosystemd")), url(r'^taggit_autosuggest/', include('taggit_autosuggest.urls')), url(r'^jsi18n/(?P\S+?)/$', - 'django.views.i18n.javascript_catalog'), + i18n.javascript_catalog), ] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT) # note the django CMS URLs included via i18n_patterns -urlpatterns += i18n_patterns('', +urlpatterns += i18n_patterns( url(r'^$', LandingView.as_view()), url(r'^admin/', include(admin.site.urls)), url(r'^datacenterlight', include('datacenterlight.urls', namespace="datacenterlight")), @@ -43,11 +43,11 @@ urlpatterns += i18n_patterns('', url(r'^blog/', include('ungleich.urls', namespace='ungleich')), url(r'^', include('cms.urls')) ) -urlpatterns += patterns('', +urlpatterns += [ url(r'^media/(?P.*)$', - 'django.views.static.serve', { + static_view.serve, { 'document_root': settings.MEDIA_ROOT, }), - ) + ] if settings.DEBUG: - urlpatterns += patterns('', url(r'^__debug__/', include(debug_toolbar.urls))) + urlpatterns += [url(r'^__debug__/', include(debug_toolbar.urls))] diff --git a/hosting/urls.py b/hosting/urls.py index 495ac312..c243f29b 100644 --- a/hosting/urls.py +++ b/hosting/urls.py @@ -1,4 +1,5 @@ from django.conf.urls import url +from django.contrib.auth import views as auth_views from .views import DjangoHostingView, RailsHostingView, PaymentVMView,\ NodeJSHostingView, LoginView, SignupView, SignupValidateView, SignupValidatedView, IndexView, \ @@ -39,7 +40,7 @@ urlpatterns = [ url(r'reset-password/?$', PasswordResetView.as_view(), name='reset_password'), url(r'reset-password-confirm/(?P[0-9A-Za-z]+)-(?P.+)/$', PasswordResetConfirmView.as_view(), name='reset_password_confirm'), - url(r'^logout/?$', 'django.contrib.auth.views.logout', + url(r'^logout/?$', auth_views.logout, {'next_page': '/hosting/login?logged_out=true'}, name='logout'), url(r'^validate/(?P.*)/$', SignupValidatedView.as_view(), name='validate') ] diff --git a/nosystemd/urls.py b/nosystemd/urls.py index d95127da..7c3965f8 100644 --- a/nosystemd/urls.py +++ b/nosystemd/urls.py @@ -1,4 +1,5 @@ from django.conf.urls import url +from django.contrib.auth import views as auth_views from .views import LandingView, LoginView, SignupView, PasswordResetView,\ PasswordResetConfirmView, DonationView, DonationDetailView, ChangeDonatorStatusDetailView,\ @@ -8,7 +9,7 @@ urlpatterns = [ url(r'^$', LandingView.as_view(), name='landing'), url(r'^login/?$', LoginView.as_view(), name='login'), url(r'^signup/?$', SignupView.as_view(), name='signup'), - url(r'^logout/?$', 'django.contrib.auth.views.logout', + url(r'^logout/?$', auth_views.logout, {'next_page': '/nosystemd/login?logged_out=true'}, name='logout'), url(r'reset-password/?$', PasswordResetView.as_view(), name='reset_password'), url(r'reset-password-confirm/(?P[0-9A-Za-z]+)-(?P.+)/$',