On Wed, Sep 16, 2009 at 10:15 AM, PlanetUnknown
<nikhil.kodil...@gmail.com>wrote:

>
> For example - User HAS "Contacts"; User HAS "Preferences"
> Usually (I'm from an Oracle/Java background) the Contacts table would
> have a "user-id" foreign key.
> However Django models refer Foreign Key relations as "Many-to-one",
> but that is not true in my case.
>

Why is it not true in your case?  You say 'User HAS "Contacts", thus it
sounds like Many different Contact instances may be associated with one
single User.  Many-to-One.  If a user can only have a single Contact then
you might want OneToOne, but you have said in a follow up message to that
suggestion that that is not what you want.  So I am having a hard time
understand what it is, exactly, that you do want.



> There is only one Contact table for a User and it might keep growing
> as new fields are added.
>

What do you mean by fields?  Fields in a Django model correspond to columns
in the database table, and you generally do not want those to be growing
over time.  If you mean rows in the table, then again, it sounds like you
want the many-to-one relation provided by ForeignKey.

The "for a User" clause on your first sentence also sounds a bit wrong.
Normally, there is only one Contact table, period.  Which user is associated
with a given row in the table would be determined by the value of the User
column in the table.

Karen

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