Re: how to use named urls from apps
And, don't forget, the form is: {% load url from future %} {% url 'auth_login' %} OR {% url auth_login %} The former is highly recommend, as the latter is deprecated and will become the default in a future Django release. If you ever get messages such as "view not found for reverse"... this has been my culprit 90% of the time. -- You received this message because you are subscribed to the Google Groups "Django users" group. To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/Gxsauy6BCOIJ. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: how to use named urls from apps
> > > 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 > > That makes sense, and explains why none of my solutions worked. The solution provided by Paul Backhouse works, I suppose because it is referring to the view function and not the url name. > -- You received this message because you are subscribed to the Google Groups "Django users" group. To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/FPKR0dd0bPUJ. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: how to use named urls from apps
On Thu, Nov 29, 2012 at 2:32 PM, Mike 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+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: how to use named urls from apps
Try {% url 'auth_login' %} That works for me in Django 1.4 On Thu, 2012-11-29 at 06:32 -0800, Mike 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 -- 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+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
how to use named urls from apps
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 -- You received this message because you are subscribed to the Google Groups "Django users" group. To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/UpjZZCj-U5wJ. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.