wq / wq.db

☁🌐 wq's db library, extending Django REST framework to support apps for geospatial field data collection, citizen science, and crowdsourcing.

Home Page:https://wq.io/wq.db/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

rest: clean up ModelSerializer.get_default_fields

sheppard opened this issue · comments

The multiple interwoven use cases are getting a bit out of hand. Probably should break down and have multiple serializers for each case:

  • Detail view (retrieve/update)
  • List view (list)
  • List view post (create)
  • GeoJSON versions?

Perhaps the view should then have more specific functions like get_serializer_for_update?

Edit: The biggest issue is really the excessive magic for generating nested serializers. Instead of detail/list/etc. serializers, this can be cleaned up simply by creating explicit, custom serializers whenever a nested serializer is needed. This will likely affect the external API so is a good candidate for 0.8. See #34.

This should probably be fixed in conjunction with #11

Also see #32 which will likely involve similar changes.