django-rest-polymorphic icon indicating copy to clipboard operation
django-rest-polymorphic copied to clipboard

Allow passing of extra keyword arguments to child classes

Open NDevox opened this issue 4 years ago • 3 comments

I'm currently trying to add https://github.com/rsinger86/drf-flex-fields serializers as children to my Polymorphic Serializers. However they rely on extra keyword arguments being passed in to the children on init. This is something Polymorphic can't really handle right now.

I would like to propose a new keyword argument called child_kwargs which is a set of kwargs that will be passed to the children along side the normal kwargs.

A PR is on its way for this.

NDevox avatar Feb 08 '21 12:02 NDevox

PR made: https://github.com/apirobot/django-rest-polymorphic/pull/34

NDevox avatar Feb 08 '21 12:02 NDevox

+1.

Being able to use drf-flex-fields with polymorphic is very much needed.

eshaan7 avatar Mar 12 '21 15:03 eshaan7

Useful mention: https://github.com/rsinger86/drf-flex-fields/issues/12#issuecomment-770628228

eshaan7 avatar Mar 12 '21 15:03 eshaan7