#25893 closed Cleanup/optimization (fixed)
Custom Lookups & Transform example lhs/rhs swap
| Reported by: | Bruno Alla | Owned by: | Bruno Alla |
|---|---|---|---|
| Component: | Documentation | Version: | dev |
| Severity: | Normal | Keywords: | |
| Cc: | Triage Stage: | Accepted | |
| Has patch: | yes | Needs documentation: | no |
| Needs tests: | no | Patch needs improvement: | no |
| Easy pickings: | yes | UI/UX: | no |
Description
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.
Change History (6)
comment:1 by , 10 years ago
| Triage Stage: | Unreviewed → Accepted |
|---|---|
| Version: | 1.8 → master |
comment:2 by , 10 years ago
| Owner: | changed from to |
|---|---|
| Status: | new → assigned |
comment:3 by , 10 years ago
| Has patch: | set |
|---|
PR