Is it possible to use a Field as a Serializer? #8717
Unanswered
Kangaroux
asked this question in
Question & Answer
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Use case: I have an object which is represented as a dict, and the dict keys are dynamic. Thus, I can't simply create a serializer with each key as a field like you normally would. Instead my "serializer" is a
DictField
and I'm validating the keys.My problem is that I can't use a
Field
as aSerializer
. ASerializer
is aField
but not the other way around. I can of course create a serializer that just contains this customDictField
, but this seems slightly roundabout. I'm adding an unnecessary extra layer to my object by doing it this way.vs.
Is there a way to declare a serializer which uses a field as itself, or do I need to add a dummy field?
Beta Was this translation helpful? Give feedback.
All reactions