On Apr 13, 2009, at 5:55 AM, Shai Berger wrote:

> I think a stronger case can be made: The reverse OneToOne relation  
> just should
> not throw DoesNotExist, always returning None when there is no  
> matching
> object. This is a realization of the idea that "OneToOne" relations  
> are
> really, in a total majority of cases, "OneToZeroOrOne" relations.

I've been down this road before, and have been shot down with comments  
along the line of "what you really want is a ForeignKey(unique=True,  
null=True)". The problem is that you can't easily follow the reverse  
of that (it requires a separate query, which could get very  
expensive).  #7270 attempts to make that case not require an extra  
query for both 121 fields and FK(unique=True), and to have  
FK(unique=True) have an accessor which makes it syntactically similar  
to 121.  The current leaning for that ticket the last time I talked  
with Malcolm is that the 121 portion is very likely to get accepted,  
the FK(unique=True) portion is less likely.  However, if you had the  
FK part, would that resolve most of your issues, with the exception of  
the model inheritance instances?

Thanks,
George

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/django-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to