My apologies: I was running my app from apache, so none of my changes were reflected!
I'm now running into the development server and trying again all the login stuff!
Thank you all!
On 04/29/2012 01:59 AM, yati sagade wrote:
Hi
Have you set the LOGIN_URL setting in settings.py? That setting should be assigned a location(e.g., "/login/") to redirect to when your view is called without the user logged in. Also, you can do this if for some reason you don't want to have that setting.
@login_required(login_url="/login/")
def index(request):
....
On Sun, Apr 29, 2012 at 10:15 AM, Jonathan Baker <jonathandavidbaker@gmail.com> wrote:
Apologies, as I shouldn't have assumed that the import had not taken place. Would you mind posting the views.py to pastebin or codepad?--
On Sat, Apr 28, 2012 at 2:24 PM, marcelo nicolet <marcelo.nicolet@gmail.com> wrote:
Thanks, but of course the views module does the import.
I'm a python newbie. Just to test it, I commented the import line, and the page loads without trouble. I suppose that referencing a symbol not imported would raise an exception!
On 04/28/2012 04:18 PM, Jonathan D. Baker wrote:
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.
Jonathan D. Baker
Developer
http://jonathandbaker.com
--
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.
--
Yati Sagade
Twitter: @yati_itay
Organizing member of TEDx EasternMetropolitanBypass
http://www.ted.com/tedx/events/4933
https://www.facebook.com/pages/TEDx-EasternMetropolitanBypass/337763226244869
--
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