The LOGIN_REDIRECT_URL setting points to this view, where I want to
redirect again according to the group the user is in:

@login_required
def after_login(request):
    print "after_login"
    groups = request.user.groups.all()
    if groups:
        # use first one
        name = str(groups[0].name)
        if name == 'superadmin':
            print "redir superadmin"
            print reverse("superadminhome")
            HttpResponseRedirect(reverse("superadminhome"))
            print "here now"
        elif name == 'admingrants':
            HttpResponseRedirect(reverse("admingrants"))
        elif name == 'adminepa':
            HttpResponseRedirect(reverse("adminepa"))
        elif name == 'cityaccessgrants':
            HttpResponseRedirect(reverse("epacityaccess"))
        elif name == 'cityaccessepa':
            HttpResponseRedirect(reverse("grantscityaccess"))

    else:
        request.notifications.create("Your login is not in any group -
please notify a superadmin to get access", "error")
        request.user.logout()

    # should never get here, but does
    return render_to_response('registration/login_success.html',
                          { }, context_instance=RequestContext
(request))


When run this prints:

after_login
redir superadmin
/superadmin/
here now

The /superadmin/ url works fine if I type it directly into the
browser.
The question is, why is the redirect not working?   All branches in
this function redirect and it should never get to the end but it does.

Thanks

--

You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=.


Reply via email to