Thursday, November 29, 2012

Re: how to use named urls from apps

On Thu, Nov 29, 2012 at 2:32 PM, Mike <mike.thon@gmail.com> wrote:
> I'm trying to use the url template tag to call the login view from
> contrib.auth. I've tried the following but none work:
>
> {% url login %}
> {% url auth:login %}
> {% url auth.login %}
> {% url contrib.auth.login %}
>
> Can someone enlighten me please?
> Mike
>

Named urls are URLs defined in your urlconf that have named views. The
contrib auth app, although it provides a bunch of views, does not
automatically install any of them at any URLs, hence this would fail.

If you include the login view in one of your urlconfs, it will not
have the 'auth' app label, it will have whatever name you decide to
give it.

Cheers

Tom

PS: The fully qualified view name may have worked -
"django.contrib.auth.views.login". There is a function at
"django.contrib.auth.login", but that function is used to actually log
users in, not to present a login form and process it.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

No comments:

Post a Comment