Re: OneToOneField usage

2010-06-16 Thread bob84123
> Is there a particular reason why using a related OneToOneField raises > DoesNotExist instead of returning None? > > | class Person( Model ): > |    pass > | > | class Pet( Model ): > |    owner = OneToOneField( Person ) > | > | # Assuming "joe" exists as a Person > | >>> kitty = joe.pet > | DoesN

Re: OneToOneField usage

2010-05-14 Thread Peter Herndon
On May 14, 2010, at 5:43 AM, Tom Evans wrote: > On Thu, May 13, 2010 at 7:31 PM, Daniel Roseman wrote: >> >> >> On May 13, 5:35 pm, Peter Herndon wrote: >>> On May 13, 2010, at 10:29 AM, TallFurryMan wrote: >>> Hello Django users, >>> Is there a particular reason why using a relat

Re: OneToOneField usage

2010-05-14 Thread Tom Evans
On Thu, May 13, 2010 at 7:31 PM, Daniel Roseman wrote: > > > On May 13, 5:35 pm, Peter Herndon wrote: >> On May 13, 2010, at 10:29 AM, TallFurryMan wrote: >> >> > Hello Django users, >> >> > Is there a particular reason why using a related OneToOneField raises >> > DoesNotExist instead of returni

Re: OneToOneField usage

2010-05-13 Thread TallFurryMan
Thanks for this insight. I was using OneToOneField in the same way as ForeignKey. | class Person( Model ): | pass | | class Pet( Model ): | owner = ForeignKey( Person ) | | # Assuming "joe" exists as a Person | >>> kitty = joe.pet_set.get_or_create() Yes, in that situation "joe.pet_set" i

Re: OneToOneField usage

2010-05-13 Thread Daniel Roseman
On May 13, 5:35 pm, Peter Herndon wrote: > On May 13, 2010, at 10:29 AM, TallFurryMan wrote: > > > Hello Django users, > > > Is there a particular reason why using a related OneToOneField raises > > DoesNotExist instead of returning None? > > Any query you make that is supposed to return one or

Re: OneToOneField usage

2010-05-13 Thread Peter Herndon
On May 13, 2010, at 10:29 AM, TallFurryMan wrote: > Hello Django users, > > Is there a particular reason why using a related OneToOneField raises > DoesNotExist instead of returning None? Any query you make that is supposed to return one or more instances, that instead cannot find any results,

OneToOneField usage

2010-05-13 Thread TallFurryMan
Hello Django users, Is there a particular reason why using a related OneToOneField raises DoesNotExist instead of returning None? | class Person( Model ): |pass | | class Pet( Model ): |owner = OneToOneField( Person ) | | # Assuming "joe" exists as a Person | >>> kitty = joe.pet | DoesNot