That's interesting, I hadn't thought about using a hidden input for
next in the two login templates.

In the end, though, I went with just one login template.

And rather than use UserProfiles (since there were no additional
attributes I needed to attach to the default User model, and my two
user types were not related otherwise), I with Groups (https://
docs.djangoproject.com/en/dev/topics/auth/#groups) instead.

I.e., I created two groups, one for each type of user, and at signup,
assigned them to group A/B accordingly.

LOGIN_REDIRECT_URL was set to a view function that checked the Group
belonging to request.user, and dispatched to the right start page.

I also wrote a decorator for each view function in /dashboard and /
console, to check that the given request.user was eligible to invoke
the underlying function.

So far, in test, it does exactly what I need it to do, based on the
original design.

So, I'd like to say thank you to everyone who replied to this thread;
your suggestions were helpful, and I wouldn't have discovered the
Groups capability without them.

On Jul 22, 11:06 am, Alexey Luchko <[email protected]> wrote:
> On 22.07.2011 17:32, dpapathanasiou wrote:
>
> > So you're saying: have the function which handles the post-login
> > request (i.e., defined in with LOGIN_REDIRECT_URL in settings.py and
> > in urls.py to some corresponding views.py function) make that type
> > check of user A/B, and simply redirect accordingly?
>
> You can try redirect twice.  Set fixed LOGIN_REDIRECT_URL to a view that
> makes further redirect based on user permissions.
>
> Or you can try fixed hidden input next in the login templates.

-- 
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.

Reply via email to