To be honest I don't really see why you would need multiple user
profile models,
instead of having one user profile model, and each entry would define
a different
user profile.

Of course I don't know the full details/requirementes of your project,
and what exactly you are
trying to do ... but I cannot think of a reason off the top of my
head, why multiple user profile
*models* would be really necessary.




On Feb 20, 4:12 am, Gok Mop <gok...@gmail.com> wrote:
> On Feb 19, 6:39 pm, Andrew Ingram <a...@andrewingram.net> wrote:
>
> > Simplest solution : don't worry about the AUTH_PROFILE_MODULE setting.
>
> > I'm working on a site with numerous modules that contain user account
> > information, such as orders and newsletter preferences. I just have a
> > foreignkey to the auth User on each of these, eg:
>
> > class OrderAccount(models.Model):
> >     user = models.ForeignKey(User,related_name="order_account")
>
> > class NewsletterAccount(models.Model):
> >     user = models.ForeignKey(User,related_name="newsletter_account")
>
> Sounds like a good idea...thanks.
>
> > Then, when you're interacting with a user model you can get any of your
> > account models with user.order_account or user.newsletter_account.
>
> This is the part that I'm not sure about though.  So let's say I have
> 4 objects that all take this same approach.  (Call them foo, bar, baz,
> and quux).  Then one of my views gets a user object, and needs to
> figure out which attached object is relevant.  (There's only one
> possibility).  Does that mean that I have to do:
>
> myobj = user.foo_account
> if myobj == None: myobj = user.bar_account
> if myobj == None: myobj = user.baz_account
> if myobj == None: myobj = user.quux_account
>
> ?
>
> In short, how do I tell which field I should be accessing?  Only one
> will be non-None.
--~--~---------~--~----~------------~-------~--~----~
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