#3885: [multi-db] bug in relating models across different db's
---------------------------+------------------------------------------------
   Reporter:  ben          |                Owner:  adrian        
     Status:  new          |            Component:  Core framework
    Version:  SVN          |           Resolution:                
   Keywords:  multiple db  |                Stage:  Unreviewed    
  Has_patch:  0            |           Needs_docs:  0             
Needs_tests:  0            |   Needs_better_patch:  0             
---------------------------+------------------------------------------------
Comment (by anonymous):

 Ok I believe I've found the source of this problem, in
 django.db.models.query around line 850. In the part of lookup_inner that
 checks for a one-to-one or many-to-one field, new_opts is set to
 field.rel.to._meta... I belive this should be set back to opts:
 
 From:
 {{{
 if field:
             if field.rel: # One-to-One/Many-to-one field
                 new_table = current_table + '__' + name
                 new_opts = field.rel.to._meta
                 new_column = new_opts.pk.column
                 join_column = field.column
                 raise FieldFound
 }}}
 To:
 {{{
 if field:
             if field.rel: # One-to-One/Many-to-one field
                 new_table = current_table + '__' + name
                 new_opts = opts
                 new_column = new_opts.pk.column
                 join_column = field.column
                 raise FieldFound
 }}}
 
 As it's such a simple change I haven't supplied a patch.
 Ben

-- 
Ticket URL: <http://code.djangoproject.com/ticket/3885#comment:4>
Django Code <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