Fix url which will be deprecated in Django 1.10

This commit is contained in:
Andrii Marynets 2017-07-19 00:39:52 +03:00
parent ddd0594976
commit 3fc1cd9463
4 changed files with 13 additions and 10 deletions

View file

@ -1,5 +1,6 @@
from django.conf.urls import url from django.conf.urls import url
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import ugettext_lazy as _
from django.contrib.auth import views as auth_views
from . import views from . import views
from .views import ContactView, IndexView, HistoryView, LoginView, SignupView,\ from .views import ContactView, IndexView, HistoryView, LoginView, SignupView,\
@ -20,7 +21,7 @@ urlpatterns = [
url(_(r'contact/?$'), ContactView.as_view(), name='contact'), url(_(r'contact/?$'), ContactView.as_view(), name='contact'),
url(_(r'login/?$'), LoginView.as_view(), name='login'), url(_(r'login/?$'), LoginView.as_view(), name='login'),
url(_(r'signup/?$'), SignupView.as_view(), name='signup'), 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'), {'next_page': '/digitalglarus/login?logged_out=true'}, name='logout'),
url(r'reset-password/?$', PasswordResetView.as_view(), name='reset_password'), url(r'reset-password/?$', PasswordResetView.as_view(), name='reset_password'),
url(r'reset-password-confirm/(?P<uidb64>[0-9A-Za-z]+)-(?P<token>.+)/$', url(r'reset-password-confirm/(?P<uidb64>[0-9A-Za-z]+)-(?P<token>.+)/$',

View file

@ -1,8 +1,8 @@
from django.conf.urls import patterns, include, url from django.conf.urls import patterns, include, url
from django.contrib import admin from django.contrib import admin
# deprecated in version 1.8
from django.conf.urls.i18n import i18n_patterns from django.conf.urls.i18n import i18n_patterns
from django.conf.urls.static import static from django.conf.urls.static import static
from django.views import i18n, static as static_view
from django.conf import settings from django.conf import settings
from hosting.views import RailsHostingView, DjangoHostingView, NodeJSHostingView 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'^nosystemd/', include('nosystemd.urls', namespace="nosystemd")),
url(r'^taggit_autosuggest/', include('taggit_autosuggest.urls')), url(r'^taggit_autosuggest/', include('taggit_autosuggest.urls')),
url(r'^jsi18n/(?P<packages>\S+?)/$', url(r'^jsi18n/(?P<packages>\S+?)/$',
'django.views.i18n.javascript_catalog'), i18n.javascript_catalog),
] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT) ] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
# note the django CMS URLs included via i18n_patterns # note the django CMS URLs included via i18n_patterns
urlpatterns += i18n_patterns('', urlpatterns += i18n_patterns(
url(r'^$', LandingView.as_view()), url(r'^$', LandingView.as_view()),
url(r'^admin/', include(admin.site.urls)), url(r'^admin/', include(admin.site.urls)),
url(r'^datacenterlight', include('datacenterlight.urls', namespace="datacenterlight")), 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'^blog/', include('ungleich.urls', namespace='ungleich')),
url(r'^', include('cms.urls')) url(r'^', include('cms.urls'))
) )
urlpatterns += patterns('', urlpatterns += [
url(r'^media/(?P<path>.*)$', url(r'^media/(?P<path>.*)$',
'django.views.static.serve', { static_view.serve, {
'document_root': settings.MEDIA_ROOT, 'document_root': settings.MEDIA_ROOT,
}), }),
) ]
if settings.DEBUG: if settings.DEBUG:
urlpatterns += patterns('', url(r'^__debug__/', include(debug_toolbar.urls))) urlpatterns += [url(r'^__debug__/', include(debug_toolbar.urls))]

View file

@ -1,4 +1,5 @@
from django.conf.urls import url from django.conf.urls import url
from django.contrib.auth import views as auth_views
from .views import DjangoHostingView, RailsHostingView, PaymentVMView,\ from .views import DjangoHostingView, RailsHostingView, PaymentVMView,\
NodeJSHostingView, LoginView, SignupView, SignupValidateView, SignupValidatedView, IndexView, \ 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/?$', PasswordResetView.as_view(), name='reset_password'),
url(r'reset-password-confirm/(?P<uidb64>[0-9A-Za-z]+)-(?P<token>.+)/$', url(r'reset-password-confirm/(?P<uidb64>[0-9A-Za-z]+)-(?P<token>.+)/$',
PasswordResetConfirmView.as_view(), name='reset_password_confirm'), 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'), {'next_page': '/hosting/login?logged_out=true'}, name='logout'),
url(r'^validate/(?P<validate_slug>.*)/$', SignupValidatedView.as_view(), name='validate') url(r'^validate/(?P<validate_slug>.*)/$', SignupValidatedView.as_view(), name='validate')
] ]

View file

@ -1,4 +1,5 @@
from django.conf.urls import url from django.conf.urls import url
from django.contrib.auth import views as auth_views
from .views import LandingView, LoginView, SignupView, PasswordResetView,\ from .views import LandingView, LoginView, SignupView, PasswordResetView,\
PasswordResetConfirmView, DonationView, DonationDetailView, ChangeDonatorStatusDetailView,\ PasswordResetConfirmView, DonationView, DonationDetailView, ChangeDonatorStatusDetailView,\
@ -8,7 +9,7 @@ urlpatterns = [
url(r'^$', LandingView.as_view(), name='landing'), url(r'^$', LandingView.as_view(), name='landing'),
url(r'^login/?$', LoginView.as_view(), name='login'), url(r'^login/?$', LoginView.as_view(), name='login'),
url(r'^signup/?$', SignupView.as_view(), name='signup'), 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'), {'next_page': '/nosystemd/login?logged_out=true'}, name='logout'),
url(r'reset-password/?$', PasswordResetView.as_view(), name='reset_password'), url(r'reset-password/?$', PasswordResetView.as_view(), name='reset_password'),
url(r'reset-password-confirm/(?P<uidb64>[0-9A-Za-z]+)-(?P<token>.+)/$', url(r'reset-password-confirm/(?P<uidb64>[0-9A-Za-z]+)-(?P<token>.+)/$',