@login_required(redirect_field_name='redirect_to')
def login_protected_view_changed_redirect(request):
 t = Template('This is a login protected test. Username is {{ user.username }}.', name='Login Template')
 c = Context({'user': request.user})
 return HttpResponse(t.render(c))

@ login_required ( redirect_field_name = 'redirect_to' ) def login_protected_view_changed_redirect ( request ) : t = Template ( 'This is a login protected test. Username is {{ user.username }}.' , name = 'Login Template' ) c = Context ( { 'user' : request . user } ) return HttpResponse ( t . render ( c ) )
a simple view that is login protected with a custom redirect field set .