#25893: Custom Lookups & Transform example lhs/rhs swap
--------------------------------------+--------------------
     Reporter:  browniebroke          |      Owner:  nobody
         Type:  Cleanup/optimization  |     Status:  new
    Component:  Documentation         |    Version:  1.8
     Severity:  Normal                |   Keywords:
 Triage Stage:  Unreviewed            |  Has patch:  0
Easy pickings:  1                     |      UI/UX:  0
--------------------------------------+--------------------
 In the doc for lookups and transform, in the example on optimizing
 lookups:
 https://docs.djangoproject.com/en/1.9/howto/custom-lookups/#writing-an-
 efficient-abs-lt-lookup

 The paragraph after the code snippets confused me:

   There are a couple of notable things going on. First,
 AbsoluteValueLessThan isn’t calling process_lhs(). Instead it skips the
 transformation of the lhs done by AbsoluteValue and uses the original lhs.
 That is, we want to get 27 not ABS(27)

 I initially though that lhs and rhs were swapped, but after asking on the
 #django IRC channel, I was advised that the confusion come from the last
 sentence, which should actually refer to the left of the SQL, rather than
 the right side:

   That is, we want to get "experiments"."change" not
 ABS("experiments"."change")

 Happy to submit a PR if suggested solution is accepted.

--
Ticket URL: <https://code.djangoproject.com/ticket/25893>
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 django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/055.0e030a86c9b3f20e70adc1e31b2c4306%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to