#5582: Default manager and model init methods should allow raw field name
arguments for foreign keys
------------------------------------------------+---------------------------
Reporter:  Simon Litchfield <[EMAIL PROTECTED]>  |       Owner:  nobody         
 
  Status:  new                                  |   Component:  Database wrapper
 Version:  SVN                                  |    Keywords:                  
   Stage:  Unreviewed                           |   Has_patch:  0               
------------------------------------------------+---------------------------
 I can do this --

 {{{
 profile = Profile(name='Example')
 profile.user_id = 47
 profile.save()
 }}}

 But not this --

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

 Also can't get_or_create, or do anything much with only user_id directly.
 Apparently I need to instantiate a User object just for the sake of it(?)
 Turns out either a big overhead (50+ extra queries on this particular
 page!) -or- a bunch of unnecessary code.

 More importantly though, it seems at least a bit confusing and
 inconsistent, that I can access it by attribute but not by argument.

 Surely it would be easy enough to allow fieldname_id as init/filter
 arguments on foreign keys. If anyone else agrees, I'll run up the patch?

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