Changes between Initial Version and Version 1 of Ticket #16173


Ignore:
Timestamp:
Jun 8, 2011, 3:23:36 PM (13 years ago)
Author:
Aymeric Augustin
Comment:

Fixed wiki formatting.

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #16173

    • Property UI/UX unset
  • Ticket #16173 – Description

    initial v1  
    1 __get__ on ForeignKey field uses manager to query the values.
     1`__get__` on !ForeignKey field uses manager to query the values.
    22
    3 The code is as given below
     3The code is as given below:
    44
    5 # If the related manager indicates that it should be used for
     5{{{
     6            # If the related manager indicates that it should be used for
    67            # related fields, respect that.
    78            rel_mgr = self.field.rel.to._default_manager
     
    910            if getattr(rel_mgr, 'use_for_related_fields', False):
    1011                rel_obj = rel_mgr.using(db).get(**params)
    11                
    12 Check the last line 'rel_obj = rel_mgr.using(db).get(**params)' for using rel_mgr with multiple databases. rel_mgr.using(db) returns a queryset. If developer has written a Custom Manager class for which 'get' is overriden, then Custom Managers 'get' function will never get called. This results in surprises to the developer. I think this line should changed to
     12}}}
     13             
     14Check the last line `rel_obj = rel_mgr.using(db).get(**params)` for using `rel_mgr` with multiple databases. `rel_mgr.using(db)` returns a queryset. If developer has written a custom manager class for which `get` is overriden, then custom managers `get` function will never get called. This results in surprises to the developer. I think this line should changed to:
    1315
     16{{{
    1417    rel_obj = rel_mgr.db_manager(db).get(**params)
    15 
    16 
     18}}}
Back to Top