Friday, October 24, 2014

Re: New way to use URL dispatchers?

Ah, thank you!
i thought that it was introduced long ago (something like 1.6) and is in test period, so it will be officially deprecated after 1.8, and the 1.7 would be the 'hybrid' version that will allow both of them.

so now, i can stick with the old one, thank you :)

Le samedi 25 octobre 2014 03:39:33 UTC+1, Russell Keith-Magee a écrit :

Hi Aliane,

You're getting tripped up by the version number of your documentation, combined with an understanding of the way we handle deprecations.

When the documentation says "Deprecated since version 1.8", it means "Version 1.8 introduced this change". Versions 1.7 and earlier *doesn't* include the change. 

However, version 1.8 hasn't been released yet. The documentation you referenced is the *development* documentation - that is, it's the documentation for the version of Django that is currently in development (i.e., 1.8). There's a yellow banner at the top of the page to warn you about this.

When it is released, Django 1.8 will include support for the new preferred format for URLpatterns. Django 1.7 doesn't support this new format, and the documentation for version 1.7:


doesn't mention the new format. 

Hope that helps!

Yours,
Russ Magee %-)


On Sat, Oct 25, 2014 at 10:11 AM, Aliane Abdelouahab <alabde...@gmail.com> wrote:
Hi,
in the docs, i only see the 'list' way, so why Django 1.7 dont generate the url by the new way and still use the old way?
because i found:

Deprecated since version 1.8: urlpatterns should be a plain list of django.conf.urls.url() instances instead.


as the example here:
from django.conf.urls import url    from . import views    urlpatterns = [      url(r'^articles/2003/$', views.special_case_2003),      url(r'^articles/([0-9]{4})/$', views.year_archive),      url(r'^articles/([0-9]{4})/([0-9]{2})/$', views.month_archive),      url(r'^articles/([0-9]{4})/([0-9]{2})/([0-9]+)/$', views.article_detail),  ]
so the urls.py should be like:

from django.conf.urls import patterns, include, url
from django.contrib import admin

urlpatterns = [
    # Examples:
    # url(r'^$', 'First.views.home', name='home'),
    # url(r'^blog/', include('blog.urls')),

    url(r'^admin/', include(admin.site.urls)),
]

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/253da748-e5a3-45f3-8195-bbd08754e844%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/f560b101-932f-47bf-9e7b-a3d13f362f62%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment