Re: Checking for user type in view

2011-04-25 Thread Shawn Milochik
You can use a user profile for a lot more, and there's no reason the two roles have to be mutually exclusive when you're creating your own class. I just wanted to make that point. I have never used the built-in groups myself, but from your explanation it seems like a good solution for the original

Re: Checking for user type in view

2011-04-24 Thread Mike Dewhirst
On 25/04/2011 7:15am, Kenny Meyer wrote: Hello guys, In my application models I have two models, Judge and Participant: Another way might be to use django groups. Have a participant group and a judge group and pop your users into one or the other. I prefer this approach for my own purposes

Re: Checking for user type in view

2011-04-24 Thread Kenny Meyer
On Sun, Apr 24, 2011 at 5:23 PM, Shawn Milochik wrote: > It's not recommended that you subclass User. > > Better: Create a class to use for a user profile and associate it with > the User using the instructions here: > > http://docs.djangoproject.com/en/1.3/topics/auth/#storing-additional-informat

Re: Checking for user type in view

2011-04-24 Thread Kenny Meyer
> I have done the following, and it works most of the time for me: > > def index(request): >    user = request.user >    if user.is_authenticated(): >        if user.is_superuser: >            return redirect('/admin') > >        judge = None >        participant = None >        competition = None

Re: Checking for user type in view

2011-04-24 Thread Shawn Milochik
It's not recommended that you subclass User. Better: Create a class to use for a user profile and associate it with the User using the instructions here: http://docs.djangoproject.com/en/1.3/topics/auth/#storing-additional-information-about-users Then give that class a 'role' field or something

Checking for user type in view

2011-04-24 Thread Kenny Meyer
Hello guys, In my application models I have two models, Judge and Participant: from django.contrib.auth.models import User class Judge(User): pass class Participant(User): pass In my view I want to find out if the authenticated user is either a Judge or a Participant. How can