You have to be sure and import the module at the top of your script: from django.contrib.auth.decorators import login_required. Otherwise, it's never in scope and thus not available.
Sent from my iPhone
On Apr 28, 2012, at 1:00 PM, marcelo nicolet <marcelo.nicolet@gmail.com> wrote:
> Hi
> 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?
>
> TIA
>
> --
> 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.
>
--
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.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment