1
0
mirror of https://github.com/django/django.git synced 2025-06-05 03:29:12 +00:00

[1.8.x] Fixed #25893 -- Corrected custom lookups example.

Backport of ffcdb0b471d0afc72b42b0a2b0c0c4fb45d7b6b1 from master
This commit is contained in:
Bruno Alla 2015-12-08 18:31:55 +00:00 committed by Tim Graham
parent f179d35f54
commit c0c2c7ecd6

View File

@ -202,10 +202,10 @@ The implementation is::
There are a couple of notable things going on. First, ``AbsoluteValueLessThan`` There are a couple of notable things going on. First, ``AbsoluteValueLessThan``
isn't calling ``process_lhs()``. Instead it skips the transformation of the isn't calling ``process_lhs()``. Instead it skips the transformation of the
``lhs`` done by ``AbsoluteValue`` and uses the original ``lhs``. That is, we ``lhs`` done by ``AbsoluteValue`` and uses the original ``lhs``. That is, we
want to get ``27`` not ``ABS(27)``. Referring directly to ``self.lhs.lhs`` is want to get ``"experiments"."change"`` not ``ABS("experiments"."change")``.
safe as ``AbsoluteValueLessThan`` can be accessed only from the Referring directly to ``self.lhs.lhs`` is safe as ``AbsoluteValueLessThan``
``AbsoluteValue`` lookup, that is the ``lhs`` is always an instance of can be accessed only from the ``AbsoluteValue`` lookup, that is the ``lhs``
``AbsoluteValue``. is always an instance of ``AbsoluteValue``.
Notice also that as both sides are used multiple times in the query the params Notice also that as both sides are used multiple times in the query the params
need to contain ``lhs_params`` and ``rhs_params`` multiple times. need to contain ``lhs_params`` and ``rhs_params`` multiple times.