#13513: _collect_sub_objects() does not take the database into the account
---------------------------------------------------+------------------------
          Reporter:  gavoja                        |         Owner:  nobody
            Status:  closed                        |     Milestone:  1.2   
         Component:  Database layer (models, ORM)  |       Version:  SVN   
        Resolution:  fixed                         |      Keywords:        
             Stage:  Accepted                      |     Has_patch:  1     
        Needs_docs:  0                             |   Needs_tests:  0     
Needs_better_patch:  0                             |  
---------------------------------------------------+------------------------
Changes (by russellm):

  * stage:  Unreviewed => Accepted
  * milestone:  => 1.2

Comment:

 To explain the discrepancy between the proposed patch and the committed
 patch; it isn't necessary to pass the database down as an argument - it
 can (and should) be derived from the relation with related objects. This
 was being correctly handled for all relation types *except* m2m relations,
 which have an m2m table; because the m2m table wasn't being queried using
 one of the descriptors on the related objects that would force database
 assignment, the query was being allocated to the default database. The
 solution is to do a write database lookup using the source object as a
 hint, and force the query on the through object onto that database. This
 is analogous to what is done in the m2m descriptors.

-- 
Ticket URL: <http://code.djangoproject.com/ticket/13513#comment:4>
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 [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-updates?hl=en.

Reply via email to