Allow specifying omit/fields params via the Serializer context#17
Allow specifying omit/fields params via the Serializer context#17cb109 wants to merge 2 commits intodbrgn:masterfrom
Conversation
This allows passing omit/fields values to drf-dynamic-fields from a lower level API, useful when creating serializers manually, e.g. inside other serializers.
4b4a3c1 to
817e49c
Compare
|
@cb109 i mentioned in the other thread about my worries with a nested serializer. Especially for model serializers whose Try for yourself, and see if a plain serializer without the dynamic fields is more performant. Having said that, performance isn't everything, and you've done a good job re-using the existing code. I worry that the interface (via If that or are you doing something like this: |
|
@jtrain Good to know! I am always looking at serializer performance, since changing things there can easily break usability for me. You are right, using the |
|
Currently blocked by #18. |
Why this
I really like the flexibility that drf-dynamic-fields provides on a request level, but I found it lacking an internal way to specify this directly on a Serializer object. I can use a crude hack to extend the wrapped
_request.GETdict, but I would prefer this PR instead.What it does
This allows passing omit/fields values to drf-dynamic-fields from a lower level API, useful when creating serializers manually, e.g. inside other serializers.
If both
query_paramsandserializer.contextspecify the same parameters thecontexttakes precedence, since it is the more internal interface.How to use