django-rest-framework-gis

How can I flatten a foreignkey object with django-rest-framework-(gis)

血红的双手。 提交于 2021-01-02 06:34:41
问题 I have searched long and far for a solution that is up to date and specific to my problem but have yet not found a solution or a clear documentation on what I really need to do in order to flatten a relationship to become geojson compliant. This question is almost identical to mine, however the solutions or answers does not solve the problem and still produces invalid GeoJSON. django-rest-framework-gis related field Related Set serializer geo_field as PointField from another model - Django

django-rest-framework-gis related field

早过忘川 提交于 2019-12-10 21:25:48
问题 I have a geographical model structure where multiple events can have the same location: class Event(models.Model): name = models.CharField(max_length=128, blank=True, null=True) location = models.ForeignKey('MarketLocation', null=True, blank=True) class EventLocation(models.Model): location = models.PointField(srid=4326) I am using the GeoFeatureModelSerializer provided by django-rest-framework-gis to output a single JSON object but the PointField is being rendered as a string instead of a