With the changes in Django 1.8 and 1.9 I am lost with URLs.
In Django 1.6.5 I had:
urlpatterns = patterns('',
url(r'^select2/', include('django_select2.urls')),
url(r'^login/$', 'django.contrib.auth.views.login', {'template_name':'login.html'}, name='login'),
url(r'^logout/$', 'django.contrib.auth.views.logout', {'next_page':'login'}, name='logout'),
url(r'^cambiar-pass/$', 'django.contrib.auth.views.password_change', {'template_name':'cambiar-pass.html', 'post_change_redirect':'login'}, name='cambiar_pass'),
url(r'^admin/', include(admin.site.urls)),
Now I have the first part right:
urlpatterns = [
url(r'^admin/', admin.site.urls),
url(r'^$', TemplateView.as_view(template_name='publico/index.html'), name='home'), ...
But I don't know how the other lines I have written are going, since they had arguments in version 1.6.5
I don't get error but warning:
RemovedInDjango110Warning: Support for string view arguments to url() is deprecated and will be removed in Django 1.10 (got django.contrib.auth.views.password_change). Pass the callable instead.
url(r'^cambiar-pass/$', 'django.contrib.auth.views.password_change', {'template_name':'cambiar-pass.html', 'post_change_redirect':'login'}, name='cambiar_pass'),```
It is just a warning for you to get used to the change that is coming, what it tells you is that from now on
Django 1.10
you will no longer be able to use the name of the views as text in the function parameterurl()
, that is, you will have to change this:For this:
Note:
This has nothing to do with whether views are function-based (FBV) or class-based (CBV), it applies to both, no matter which one you use:
EITHER:
What error does it give you? the only thing that for the moment would be a , "comma" after
.html
Cheers