id summary reporter owner description type status component version severity resolution keywords cc stage has_patch needs_docs needs_tests needs_better_patch easy ui_ux 25893 Custom Lookups & Transform example lhs/rhs swap Bruno Alla Bruno Alla "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." Cleanup/optimization closed Documentation dev Normal fixed Accepted 1 0 0 0 1 0