On Tue, 2009-03-17 at 09:49 -0700, ntoll wrote:
> Guys,
> 
> Asking for advice here.
> 
> What is the best way to extend the User class in
> django.contrib.auth.models...?
> 
> I could either inherit the class for my own model and add fields /
> methods or use get_profile(). Now, whilst I realise that get_profile()
> is the official advice it seems a tad out-of-date now that there is
> model inheritance (for which get_profile() provided a means of
> overcoming).

That's not correct. They are two different approaches, with different
functionality.

Once you've created a User instance, you cannot create a subclass
instanced based on the original instance (you can't do it even in
Python, but Django also doesn't provide any way to wrap the database
equivalent, since Django's model inheritance is modeled on Python's).
Whereas you *can* create a user profile object after the fact and it
will be retreived with get_profile().

Since User objects are often created quite separately from profiles
(e.g. through the admin), this means the get_profile() approach is
probably going to be more generally useful.

This has come up a number of times in the past. I wrote a more expansive
reply here, for example:
http://groups.google.com/group/django-users/msg/baa3afd55b14ad68

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