So in Django the two lines of url code below work the same:
urlpatterns = patterns('',
url(r'^login/$', 'django.contrib.auth.views.login'),
(r'^login/$', 'django.contrib.auth.views.login')
)
AFAIK, the only difference is I can define name='login'
so I can use it for reversing url. But besides this, is there any other differences?
There is no difference whatsoever. Have a look at the patterns
function in django.conf.urls.__init__.py
, if your url is a list
or tuple
then it is wrapped up by the url
function anyway before being appended to the list of available patterns.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With