Although I still pass the parent context from UserSerializers to UserProfileSerializers, I no longer explicitly add "user" to that context. It is just too complicated to ensure the context is always correct since the UserSerializer is used in so many different ways.
Instead, I split the serializer in orbis that was giving me so much trouble into 2 distinct classes:
the OrbisUserFeedbackRecordSerializer which is used by the OrbisUserFeedbackRecordView - which has a ContextVariableDefault field because it's used outside the OrbisUserProfileSerializer
and the OrbisUserFeedbackRecordNestedSerializer which is used by every other
view and so is never used w/out a parent OrbisUserProfileSerializer - and therefore has no need of a ContextVariableDefault field
Although I still pass the parent context from
UserSerializers
toUserProfileSerializers
, I no longer explicitly add "user" to that context. It is just too complicated to ensure the context is always correct since theUserSerializer
is used in so many different ways.Instead, I split the serializer in orbis that was giving me so much trouble into 2 distinct classes:
OrbisUserFeedbackRecordSerializer
which is used by theOrbisUserFeedbackRecordView
- which has aContextVariableDefault
field because it's used outside theOrbisUserProfileSerializer
OrbisUserFeedbackRecordNestedSerializer
which is used by every other view and so is never used w/out a parentOrbisUserProfileSerializer
- and therefore has no need of aContextVariableDefault
field