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" is a QuerySet, not a Model. As
OneToOneField subclasses ForeignKey, this is not immediately clear.

"OneToOneField: a one-to-one relationship. Conceptually, this is
similar to a ForeignKey with unique=True, but the "reverse" side of
the relation will directly return a single object."

I found the ForeignKey syntax very handy, so was trying to apply it
blindly to OneToOneField.

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

Reply via email to