On Tue, Jan 27, 2009 at 2:57 PM, Jonathan Nelson <[email protected]>wrote:
> > I'm trying to decorate a view function with login_required. I want > the user to be redirected to the current view after they log in. > > I'm trying: > > @login_required(redirect_field_name=request.path) > def myview(request, comment_id): > ....return render_to.... > > but, I'm getting a "NameError: name 'request' is not defined". I'm > assuming that's because the decorator doesn't have access to the > request object. Is there a way to have access to that in the > decorator? I can't create my url like this, either: > > @login_required(redirect_field_name='/myview/%s' %comment_id ) > def myview(request, comment_id): > ....return render_to.... > > because the decorator doesn't seem to have access to the post > variables. > > Any thoughts? > I don't believe redirect_field_name does what you think it does. Try just @login_required with no parameters and I think it will do what you are looking for. Karen --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---

