#23940: Disallow/warn on fields named exact
-------------------------------------+-------------------------------------
     Reporter:  zhiyajun11           |                    Owner:  nicwest
         Type:  New feature          |                   Status:  assigned
    Component:  Database layer       |                  Version:  master
  (models, ORM)                      |
     Severity:  Normal               |               Resolution:
     Keywords:                       |             Triage Stage:  Ready for
                                     |  checkin
    Has patch:  1                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  1                    |                    UI/UX:  0
-------------------------------------+-------------------------------------

Comment (by jarshwah):

 I think we should try to fix this rather than add a warning. It should be
 possible to first check if the "part" is a field and use that if so.

 {{{
 .filter('field__exact__exact')
 }}}

 For each part ("field", "exact", "exact"):

 {{{
 try:
     get_field(part)
 except:
     try:
         get_transform(part)
     except:
         get_lookup(part)
 }}}

 There's already similar code to this that first tries the transform then
 falls back to lookup. We should just need to introduce similar logic that
 first checks if a part is actually a field.

--
Ticket URL: <https://code.djangoproject.com/ticket/23940#comment:15>
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 unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/068.70c7766ec29d70f0e8c6570b1421d9f9%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to