#14615: Related objects manager returns related objects with null FKs for 
unsaved
instances
--------------------------------------+-------------------------------------
          Reporter:  tonnzor          |         Owner:     
            Status:  reopened         |     Milestone:  1.3
         Component:  ORM aggregation  |       Version:  1.2
        Resolution:                   |      Keywords:     
             Stage:  Accepted         |     Has_patch:  0  
        Needs_docs:  0                |   Needs_tests:  0  
Needs_better_patch:  0                |  
--------------------------------------+-------------------------------------
Comment (by lukeplant):

 It is precisely things like a null PK that your solution doesn't cover.
 For foreign key values, we don't know whether 'None' means 'No value has
 been set' or 'database NULL'. If we'd thought about this at the beginning
 we might have used separate values to indicate those two, but it is too
 late now.

 Even without that problem, we don't want to fix this by silently returning
 an empty set of objects. It is always nonsense to ask the DB for the
 related objects of an unsaved object. So every time someone does that, it
 is a logical error in their program. Making sure that such code produces
 an empty set of results is not actually helpful.

-- 
Ticket URL: <http://code.djangoproject.com/ticket/14615#comment:7>
Django <http://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-upda...@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.

Reply via email to