#36451: Issue with GeoFeatureModelSerializer and GeneratedField returning WKT
instead of GeoJSON
-------------------------------------+-------------------------------------
     Reporter:  QyuBee               |                    Owner:  (none)
         Type:  Bug                  |                   Status:  closed
    Component:  Core                 |                  Version:  5.1
  (Serialization)                    |
     Severity:  Normal               |               Resolution:  invalid
     Keywords:                       |             Triage Stage:
                                     |  Unreviewed
    Has patch:  0                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------
Changes (by Jacob Walls):

 * resolution:   => invalid
 * status:  new => closed

Comment:

 This sounds like an issue with either djangorestframework's support for
 `GeneratedField` in `ModelSerializer` or the more specific GIS
 functionality provided by djangorestframework-gis (in its `ready()`
 method), not an issue in Django.

 > As a workaround, I’ve overridden field in serializer with GeometryField,
 but it feels like something that should be handled natively if the output
 field is a PointField.

 Taking a look at `ModelSerializer.serializer_field_mapping` in DRF, I
 don't see any fathoming of `GeneratedField`, so it's probably a missing
 feature. You could probably easily subclass that (as well as
 GeneratedField, e.g. GeneratedGeometryField) to get what you want. Hope
 that helps!
-- 
Ticket URL: <https://code.djangoproject.com/ticket/36451#comment:3>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion visit 
https://groups.google.com/d/msgid/django-updates/010701975ac88ee8-f6bac51c-cee1-4580-a210-ac5013a90f0b-000000%40eu-central-1.amazonses.com.

Reply via email to