mirror of
https://github.com/django/django.git
synced 2025-10-25 06:36:07 +00:00
Fixed #26266 -- Output the primary key in the GeoJSON serializer properties
Thanks Tim Graham for the review.
This commit is contained in:
@@ -47,6 +47,9 @@ class Serializer(JSONSerializer):
|
||||
"type": "Feature",
|
||||
"properties": self._current,
|
||||
}
|
||||
if ((self.selected_fields is None or 'pk' in self.selected_fields) and
|
||||
'pk' not in data["properties"]):
|
||||
data["properties"]["pk"] = obj._meta.pk.value_to_string(obj)
|
||||
if self._geometry:
|
||||
if self._geometry.srid != self.srid:
|
||||
# If needed, transform the geometry in the srid of the global geojson srid
|
||||
|
||||
Reference in New Issue
Block a user