Fixed #29792 -- Made GeometryField.deconstruct() handle 'extent' and 'tolerance' args.
This commit is contained in:
parent
7b9f8e38bb
commit
5a77190e66
|
@ -243,6 +243,10 @@ class GeometryField(BaseSpatialField):
|
||||||
kwargs['dim'] = self.dim
|
kwargs['dim'] = self.dim
|
||||||
if self.geography is not False:
|
if self.geography is not False:
|
||||||
kwargs['geography'] = self.geography
|
kwargs['geography'] = self.geography
|
||||||
|
if self._extent != (-180.0, -90.0, 180.0, 90.0):
|
||||||
|
kwargs['extent'] = self._extent
|
||||||
|
if self._tolerance != 0.05:
|
||||||
|
kwargs['tolerance'] = self._tolerance
|
||||||
return name, path, args, kwargs
|
return name, path, args, kwargs
|
||||||
|
|
||||||
def contribute_to_class(self, cls, name, **kwargs):
|
def contribute_to_class(self, cls, name, **kwargs):
|
||||||
|
|
|
@ -27,10 +27,14 @@ class GeometryFieldTests(SimpleTestCase):
|
||||||
srid=4067,
|
srid=4067,
|
||||||
dim=3,
|
dim=3,
|
||||||
geography=True,
|
geography=True,
|
||||||
|
extent=(50199.4814, 6582464.0358, -50000.0, 761274.6247, 7799839.8902, 50000.0),
|
||||||
|
tolerance=0.01,
|
||||||
)
|
)
|
||||||
*_, kwargs = field.deconstruct()
|
*_, kwargs = field.deconstruct()
|
||||||
self.assertEqual(kwargs, {
|
self.assertEqual(kwargs, {
|
||||||
'srid': 4067,
|
'srid': 4067,
|
||||||
'dim': 3,
|
'dim': 3,
|
||||||
'geography': True,
|
'geography': True,
|
||||||
|
'extent': (50199.4814, 6582464.0358, -50000.0, 761274.6247, 7799839.8902, 50000.0),
|
||||||
|
'tolerance': 0.01,
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in New Issue