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 | DoesNotExist: Pet matching query does not exist. SingleRelatedObjectDescriptor is expecting the related model to exist. OneToOneField being a subclass of ForeignKey, my first attempt was: | >>> kitty = joe.pet.get_or_create() | DoesNotExist: Pet matching query does not exist. It's the getter of "joe.pet" which fails. Is it that OneToOneField is not popular enough to receive such an implementation, or is there a deeper philosophical reason I don't see? -Eric -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@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.