mirror of
https://github.com/django/django.git
synced 2025-08-04 19:08:28 +00:00
Fixed #25499 -- Added the ability to pass an expression in distance lookups
Thanks Bibhas Debnath for the report and Tim Graham for the review.
This commit is contained in:
parent
4a7b58210d
commit
37d06cfc46
8 changed files with 84 additions and 33 deletions
|
@ -515,14 +515,20 @@ Distance lookups take the following form::
|
|||
|
||||
The value passed into a distance lookup is a tuple; the first two
|
||||
values are mandatory, and are the geometry to calculate distances to,
|
||||
and a distance value (either a number in units of the field or a
|
||||
:class:`~django.contrib.gis.measure.Distance` object). On every
|
||||
distance lookup but :lookup:`dwithin`, an optional
|
||||
and a distance value (either a number in units of the field, a
|
||||
:class:`~django.contrib.gis.measure.Distance` object, or a `query expression
|
||||
<ref/models/expressions>`).
|
||||
|
||||
With PostGIS, on every distance lookup but :lookup:`dwithin`, an optional
|
||||
third element, ``'spheroid'``, may be included to tell GeoDjango
|
||||
to use the more accurate spheroid distance calculation functions on
|
||||
fields with a geodetic coordinate system (e.g., ``ST_Distance_Spheroid``
|
||||
would be used instead of ``ST_Distance_Sphere``).
|
||||
|
||||
.. versionadded:: 1.10
|
||||
|
||||
The ability to pass an expression as the distance value was added.
|
||||
|
||||
.. fieldlookup:: distance_gt
|
||||
|
||||
distance_gt
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue