On 13-8-2012 21:51, Anderson wrote:

> I have 3 types of users
> 
> Clients
> Students
> Teachers
> 
> and each one have different fields and AUTH_PROFILE_MODULE is not going to
> work with 3 profiles.

Yeah, the auth module doesn't support this very well. I'd recommend
storing the shared information and a type field in the
AUTH_PROFILE_MODULE model.
So:
AUTH_PROFILE_MODULE = app.Shared
class Shared(models.Model)
    type = 'client_profile'
    birth_date = ...
    # more shared fields

class ClientProfile(models.Model)
    shared = models.OneToOneField(Shared, related_name='client_profile')

then you can do:
shared_profile = User.get_profile()
client_profile = shared_profile.client_profile

Or even dynamically, if you make sure shared.type matches extended's
related_name:
shared_profile = User.get_profile()
extended_profile = getattr(shared_profile, shared_profile.type)

-- 
Melvyn Sopacua

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