diff --git a/django/contrib/gis/measure.py b/django/contrib/gis/measure.py index 3bb23d9b641..9cb2db83a2d 100644 --- a/django/contrib/gis/measure.py +++ b/django/contrib/gis/measure.py @@ -233,6 +233,7 @@ class Distance(MeasureBase): 'clarke_link': 0.201166195164, 'fathom': 1.8288, 'ft': 0.3048, + 'furlong': 201.168, 'german_m': 1.0000135965, 'gold_coast_ft': 0.304799710181508, 'indian_yd': 0.914398530744, @@ -280,6 +281,7 @@ class Distance(MeasureBase): 'Chain (Benoit)': 'chain_benoit', 'Chain (Sears)': 'chain_sears', 'Foot (International)': 'ft', + 'Furrow Long': 'furlong', 'German legal metre': 'german_m', 'Gold Coast foot': 'gold_coast_ft', 'Indian yard': 'indian_yd', diff --git a/docs/ref/contrib/gis/measure.txt b/docs/ref/contrib/gis/measure.txt index d85ebab31bb..ddf091e05d9 100644 --- a/docs/ref/contrib/gis/measure.txt +++ b/docs/ref/contrib/gis/measure.txt @@ -93,6 +93,7 @@ Unit Attribute Full name or alias(es) ``clarke_link`` Clarke's link ``fathom`` Fathom ``rod`` Rod +``furlong`` Furlong, Furrow Long ``nm`` Nautical Mile ``nm_uk`` Nautical Mile (UK) ``german_m`` German legal metre diff --git a/docs/releases/3.0.txt b/docs/releases/3.0.txt index 7e32da32fa0..b279f9a451c 100644 --- a/docs/releases/3.0.txt +++ b/docs/releases/3.0.txt @@ -75,6 +75,9 @@ Minor features * Added the :class:`~django.contrib.gis.db.models.functions.GeometryDistance` function, supported on PostGIS. +* Added support for the ``furlong`` unit in + :class:`~django.contrib.gis.measure.Distance`. + :mod:`django.contrib.messages` ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/tests/gis_tests/test_measure.py b/tests/gis_tests/test_measure.py index fb812b03d17..8c468139e75 100644 --- a/tests/gis_tests/test_measure.py +++ b/tests/gis_tests/test_measure.py @@ -138,10 +138,15 @@ class DistanceTest(unittest.TestCase): self.assertEqual(repr(d1), 'Distance(m=100.0)') self.assertEqual(repr(d2), 'Distance(km=3.5)') + def test_furlong(self): + d = D(m=201.168) + self.assertEqual(d.furlong, 1) + def test_unit_att_name(self): "Testing the `unit_attname` class method" unit_tuple = [('Yard', 'yd'), ('Nautical Mile', 'nm'), ('German legal metre', 'german_m'), - ('Indian yard', 'indian_yd'), ('Chain (Sears)', 'chain_sears'), ('Chain', 'chain')] + ('Indian yard', 'indian_yd'), ('Chain (Sears)', 'chain_sears'), ('Chain', 'chain'), + ('Furrow Long', 'furlong')] for nm, att in unit_tuple: with self.subTest(nm=nm): self.assertEqual(att, D.unit_attname(nm))