In this particular case, when the URL call uses the full path to the view function, it is easy to do this simply by looking at the view function. In Django-1.1, it looks like this:
def redirect_to_login(next, login_url=None, redirect_field_name=REDIRECT_FIELD_NAME): "Redirects the user to the login page, passing the given 'next' page" if not login_url: login_url = settings.LOGIN_URL return HttpResponseRedirect('%s?%s=%s' % (login_url, urlquote(redirect_field_name), urlquote(next)))
This function does not even accept the request object, so in fact it is not even the right kind, and it is not even registered in django/contrib/auth/urls.py This means that it is probably intended only for use as an auxiliary function in other representations.
In any case, based on your specific example, what you probably wanted to do was use the plain old login url:
<a href="{% url django.contrib.auth.views.login %}?next={{request.path}}"> log in </a>
In addition, I believe that if you set TEMPLATE_DEBUG = True to your settings, you will get a list of all the url templates that django checked before throwing an error.
source share