views:

289

answers:

2

The tag in question:

< a href="{% url django.contrib.auth.views.login %}">Login< /a>

URLConf:

from django.contrib.auth import views
...
(r'^login/$',views.login, {'redirect_field_name' : '/' })
...

+1  A: 

For some reason it didn't like the way I was importing it.

Solution:

from django.contrib.auth.views import login

(r'^login', login, etc.)

SapphireSun
+2  A: 

it's better to use named urls, they save a lot of maintenance work in the future and typing in the first place.

if you keep name of the url the same, you can rename view function, move it to a different app, etc. you won't need to change templates or other places using this url at all.

in urls.py:

url(r'^login/',path.to.view,name='login',...)

in templates:

<a href="{%url login%}">login here</a>

in views:

login_url = reverse('login')
Evgeny
Thank you very much!
SapphireSun
you're welcome!
Evgeny