-
Notifications
You must be signed in to change notification settings - Fork 299
Load polymorphic relation serializers from string #405
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Load polymorphic relation serializers from string #405
Conversation
codecov-io
commented
Jan 24, 2018
Codecov Report
@@ Coverage Diff @@ ## master #405 +/- ## ========================================= - Coverage 91.93% 91.9% -0.03% ========================================= Files 55 55 Lines 2925 2929 +4 ========================================= + Hits 2689 2692 +3 - Misses 236 237 +1
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your contribution.
I do not think this fix is in the right place as get_polymorphic_types
is also used in other modules.
Better is to do the string import in PolymorphicSerializerMetaclass.__new__
. This way it will also only be done once and not over and over again. What do you think?
Could you also add a test case and some example for the documentation?
Thanks.
This PR mimics the functionality of
included_serializers
and allows polymorphic serializers passed toPolymorphicResourceRelatedField
to be dotted string paths, in addition to references to actualSerializer
objects. In this way, aPolymorphicResourceRelatedField
can support circular references to serializers defined in the same module.