Why this url pattern is not working?
from views import login开发者_如何转开发
from django.conf.urls.defaults import *
urlpatterns = patterns('',
*** (r'([a-zA-Z0-9]+)/login/$', login, name='login'),
)
showing me the syntax error in line ***.
http://localhost:8000/{{ slug }}/login/
is the action url in form. I want to make it using Django { % url slug login % }
tag. But it also not working.
You need to use the url()
function if you're using the name keyword:
url(r'([a-zA-Z0-9]+)/login/$', login, name='login'),
And the order of parameters to the {% url %}
tag has the url name first. So it should be:
{% url login slug %}
tuple
literals don't have named arguments. Try url()
instead.
url(r'([a-zA-Z0-9]+)/login/$', login, name='login'),
the way u are using the {% url slug login %} is not the correct syntax you have to write the name which you wrote in your urls for that template, i.e {% url login %} This is according to your url, try this it will work.........
精彩评论