1
0
mirror of https://github.com/django/django.git synced 2025-10-26 23:26:08 +00:00

Fixed #26138 -- Ensured geometry_field's geometry is always serialized

Thanks Bernd Schlapsi for the report.
This commit is contained in:
Claude Paroz
2016-01-26 11:06:29 +01:00
parent 31817dd2eb
commit 54236a2c1c
3 changed files with 21 additions and 2 deletions

View File

@@ -18,6 +18,9 @@ class Serializer(JSONSerializer):
super(Serializer, self)._init_options()
self.geometry_field = self.json_kwargs.pop('geometry_field', None)
self.srid = self.json_kwargs.pop('srid', 4326)
if (self.selected_fields is not None and self.geometry_field is not None
and self.geometry_field not in self.selected_fields):
self.selected_fields = list(self.selected_fields) + [self.geometry_field]
def start_serialization(self):
self._init_options()