Re: OneToOneFields: How do you use them?

2009-07-22 Thread Dudley Fox
That worked! Thanks, Dudley On Wed, Jul 22, 2009 at 2:49 PM, Some Guy wrote: > > Just a guess, but maybe... > p = mymodels.Person() p.name="John Smith" f = mymodels.Friend() f.name = "John Q. Smith" > > add this here so it gets an id?? > f.save() > p.friend = f p.sa

Re: OneToOneFields: How do you use them?

2009-07-22 Thread Some Guy
Just a guess, but maybe... >>> p = mymodels.Person() >>> p.name="John Smith" >>> f = mymodels.Friend() >>> f.name = "John Q. Smith" add this here so it gets an id?? f.save() >>> p.friend = f >>> p.save() On Jul 22, 12:15 pm, Dudley Fox wrote: > I have a simple test model defined: > > class Fr

OneToOneFields: How do you use them?

2009-07-22 Thread Dudley Fox
I have a simple test model defined: class Friend(models.Model): name = models.CharField(max_length=120) class Person(models.Model): name = models.CharField(max_length=120) friend = models.OneToOneField(Friend) Here is a sample of usage, and obviously I am doing something wrong... >>> p