#18375: F() doesn't work as expected across multijoin relations
-------------------------------------+-------------------------------------
     Reporter:  FunkyBob             |                    Owner:  nobody
         Type:  Bug                  |                   Status:  new
    Component:  Database layer       |                  Version:  1.4
  (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 clelland):

 akaariai, shouldn't the query in comment:3 fail with a Syntax error? You
 can't specify the same keyword argument twice. The only way to filter
 twice on the same keyword is to call .filter() twice, which is well
 defined (in execution semantics, at least), or include duplicate Q objects
 (or mix Q objects with a keyword argument). Otherwise, you at least need
 to use a different operator, to filter twice on the same database field.
 Either
 {{{
 .filter(Q(unter__available__gt=0),
 Q(unter__available__gt=F('unter__used')))
 }}}
 or
 {{{
 .filter(Q(unter__available__gte=1, unter__available__gt=F('unter__used'))
 }}}
 should trigger this behaviour, though.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/18375#comment:6>
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 https://groups.google.com/groups/opt_out.


Reply via email to