hagsteel / swampdragon

swampdragon
Other
557 stars 73 forks source link

Better control of which fields are published by ModelSerializer. #159

Open faulkner opened 9 years ago

faulkner commented 9 years ago

At the moment you can set publish_fields to publish specific fields or leave it blank to publish all of the fields that were changed.

This has a few limitations:

  1. there's no way to exclude a small number of fields without dumping all of the other fields into publish_fields
  2. there's no clean way to always publish specific fields even if the values weren't changed. The current hack around this issue is to create a serialize_<field> custom serializer since those always get included regardless of if the data changed (which seems like a bug).

My solution to this was https://github.com/faulkner/swampdragon/commit/c1e718fd48799d2f56783a83655bfbc36093ac60. I can open a pull request if this is a feature you want to support.

ZuSe commented 9 years ago

+1, i would like also see support for pushing the expanded object on every message when using nested serializers.

faulkner commented 9 years ago

@ZuSe I wouldn't mind seeing that as well. I've been wondering if it wouldn't make more sense to replace the existing serializer code with something a bit more feature complete. Marshmallow, for example, looks like it supports the nested serialization you're looking for.