SIGN IN SIGN UP

Fix for nested use

`DynamicFieldsMixin` causes nested serializer to behave improperly if
they require access to `context`.

When a serializer using `DynamicFieldsMixin` is nested, the
`self.context` cached_property is accessed during `__init__`, and
`__init__` is called at django startup time, not request time.

Subsequent calls will return the value of `self.context` that existed
during django startup, and won't have the `context` correctly set from
its parent.

This fix will mean that nested serializers don't respond to the `fields`
query param.  They never did anyway, so this shouldn't affect anyone's
production code.
J
Jervis Whitley committed
bb2fedfe2986bdee84679f69cc4fbae7958dfa90
Parent: b6a2ac3
Committed by Danilo Bargen <mail@dbrgn.ch> on 3/19/2017, 2:12:27 PM