Sunday, April 29, 2012

Re: @login_required do nothing

On 28-04-12 21:00, marcelo nicolet wrote:
> Following the on-line docs (
> https://docs.djangoproject.com/en/1.4/topics/auth/ ) I decorated my
> "index" view with @login_required, but nothing happens. In other words,
> it'supossed I would be redirected to a login page, else an exception
> migth raise. But the whole thing keeps doing as always.
> What am I doing the wrong way?

Are you using a function as a view or a new class based one?
In the latter case, the decorator won't work if you place it on the class:
http://www.caktusgroup.com/blog/2011/12/29/class-based-views-django-13/


Reinout

--
Reinout van Rees http://reinout.vanrees.org/
reinout@vanrees.org http://www.nelen-schuurmans.nl/
"If you're not sure what to do, make something. -- Paul Graham"

--
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