#5535: .get() should allow myforeignkey_id lookups
------------------------+---------------------------------------------------
   Reporter:  dcramer   |                Owner:  nobody                
     Status:  reopened  |            Component:  Database wrapper      
    Version:  SVN       |           Resolution:                        
   Keywords:            |                Stage:  Design decision needed
  Has_patch:  0         |           Needs_docs:  0                     
Needs_tests:  0         |   Needs_better_patch:  0                     
------------------------+---------------------------------------------------
Comment (by ubernostrum):

 First off, the syntax we have right now is consistent. Any time you're
 working with a relation, you use a double underscore. It is true that
 there's an undocumented attribute on models which stores the raw value of
 a related object, and that this attribute has a single underscore in its
 name, but the Django ORM has never exposed the ability to perform lookups
 on arbitrary model attributes, even when those attributes spring from
 things in the database -- lookups are enabled for the names of the model's
 fields, and nothing else -- so it's hard to argue for any inconsistency
 existing in our not exposing lookups on one such attribute.

 Second, I can't honestly see what the gain is here or what problem it
 would solve, other than saving a single character's worth of typing. The
 `get_or_create()` use case has already been shown not to apply because you
 can already do what you want with `get_or_create()`.

 So since it'd make the ORM lookup syntax inconsistent, and since no real-
 world problem has been advanced which would be solved by doing so, I'd be
 a strong -1.

-- 
Ticket URL: <http://code.djangoproject.com/ticket/5535#comment:9>
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