#5585: Default manager methods should allow _id style arguments for foreign keys
------------------------------------------------+---------------------------
Reporter:  Simon Litchfield <[EMAIL PROTECTED]>  |       Owner:  nobody         
 
  Status:  new                                  |   Component:  Database wrapper
 Version:  SVN                                  |    Keywords:                  
   Stage:  Unreviewed                           |   Has_patch:  0               
------------------------------------------------+---------------------------
 Instead of being required to do this --

 {{{
 current_user = User.objects.get(id=47)
 profile = Profile.objects.get(name='Example', user=current_user)
 }}}

 Since I can use profile.user_id, I would expect to be able to do this --

 {{{
 profile = Profile.objects.get(name='Example', user_id=47)
 }}}

 Both in terms of consistency *and* performance.

 Another example gotcha, which obviously makes sense once you know it but
 needn't be the case if filters etc supported _id style arguments --

 {{{
 pa, created = ProfileAttrib.objects.get_or_create(profile=self.profile,
                                                   attrib__id=attrib_id,
                                                   value=value,
 defaults={'attrib_id':attrib_id}
                                                   )
 }}}

 Why not, just --

 {{{
 pa, created = ProfileAttrib.objects.get_or_create(profile=self.profile,
                                                   attrib_id=attrib_id,
                                                   value=value,
                                                   )
 }}}

-- 
Ticket URL: <http://code.djangoproject.com/ticket/5585>
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