#11670: Minor limitation using fields named 'year' in related searches.
-------------------------------------+-------------------------------------
     Reporter:  andy@…               |                    Owner:
         Type:  Bug                  |                   Status:  new
    Component:  Database layer       |                  Version:  SVN
  (models, ORM)                      |               Resolution:
     Severity:  Normal               |             Triage Stage:  Accepted
     Keywords:                       |      Needs documentation:  0
    Has patch:  1                    |  Patch needs improvement:  0
  Needs tests:  0                    |                    UI/UX:  0
Easy pickings:  0                    |
-------------------------------------+-------------------------------------

Comment (by akaariai):

 Well, the idea would be that when for example order by is called, we could
 check if the order is valid at that point. It would be an trivial check to
 do:
 {{{
 for field in fields:
     if self.resolve_lookup_path(field)[LOOKUP_PART]:
         raise ValueError('Invalid order by!')
 }}}
 and that is pretty much it. We should first remove the leading '-'
 though...

 But I also think it really belongs to model._meta. Why does sql/query.py
 need to know how to travel the fields? IMHO it doesn't need to know that.
 Abstract that away in a model._meta method and just call it when needed.
 There are also other parts in Django which would benefit from this. Take a
 look at django/contrib/admin/options.py:L236.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/11670#comment:12>
Django <https://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