diff --git a/docs/howto/custom-lookups.txt b/docs/howto/custom-lookups.txt
index af7c18e..1c2cde8 100644
a
|
b
|
applied, Django uses the ``output_field`` attribute. We didn't need to specify
|
142 | 142 | this here as it didn't change, but supposing we were applying ``AbsoluteValue`` |
143 | 143 | to some field which represents a more complex type (for example a point |
144 | 144 | relative to an origin, or a complex number) then we may have wanted to specify |
145 | | ``output_field = FloatField``, which will ensure that further lookups like |
146 | | ``abs__lte`` behave as they would for a ``FloatField``. |
| 145 | that the transform return a ``FloatField`` type for further lookups. This can |
| 146 | be done by adding an ``output_field`` attribute to the transform:: |
| 147 | |
| 148 | from django.db.models import FloatField, Transform |
| 149 | |
| 150 | class AbsoluteValue(Transform): |
| 151 | lookup_name = 'abs' |
| 152 | |
| 153 | def as_sql(self, qn, connection): |
| 154 | lhs, params = qn.compile(self.lhs) |
| 155 | return "ABS(%s)" % lhs, params |
| 156 | |
| 157 | @property |
| 158 | def output_field(self): |
| 159 | return FloatField() |
| 160 | |
| 161 | This ensures that further lookups like ``abs__lte`` behave as they would for |
| 162 | a ``FloatField``. |
147 | 163 | |
148 | 164 | Writing an efficient abs__lt lookup |
149 | 165 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |