On Tue, 2009-01-27 at 00:11 +0100, Alex Rades wrote:
> Hi,
> I need to have two sets of users in my application: One is the Person
> and the other is the Company. So, I have to decide between going with
> the userprofile way or inheriting from User.
> 
> The problem with userprofile is that i can only register One class
> with AUTH_PROFILE_MODULE
> The problem with User inheritance is that I have to rewrite parts of
> UserAdmin and its Forms to have these two sets of users in the admin.

Two thoughts about this:

(1) Although you can only register on AUTH_PROFILE_MODULE, you can make
that a small class that has a GenericRelation to an appropriate set of
alternatives, one for "people" and one for "companies". Or it can be a
base class that other classes inherit from in the two cases. I'd
probably use the generic relation, but I'm not sure. 

(2) You might want to think hard about whether you're really modelling
this the right way. Companies are simply not users. There could be users
who have permissions or can take actions on behalf of a company. But
there are a lot of cases that you'll bump into where treating a company
and a user as identical types of things ("things that can be authorised
entities") will cause headaches. I've played that game, made the
mistakes, and regretted it. It's usually easier to implement a
permissions-style system so that certain users can do things on a
company-wide level and others cannot. That way you only have to worry
about users and their permissions.

Regards,
Malcolm



--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@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=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to