rest_flex_fields2.views.FlexFieldsMixin
- class rest_flex_fields2.views.FlexFieldsMixin
View mixin that restricts which fields may be expanded on list actions.
Set
permit_list_expandsto a list of field names that are allowed to be expanded when the view is handling alistrequest. The allowed names are passed to the serializer viacontext['permitted_expands']so that FlexFieldsSerializerMixin can enforce the constraint.- permit_list_expands: list[str] = []
- action: str | None = None
- get_serializer_context() dict[str, Any]
Extend the serializer context with
permitted_expandsfor list actions.When the current action is
list, addscontext['permitted_expands']populated frompermit_list_expandsso the serializer can restrict expansion accordingly.