rest_flex_fields2.views.FlexFieldsMixin ======================================= .. py:class:: rest_flex_fields2.views.FlexFieldsMixin View mixin that restricts which fields may be expanded on list actions. Set ``permit_list_expands`` to a list of field names that are allowed to be expanded when the view is handling a ``list`` request. The allowed names are passed to the serializer via ``context['permitted_expands']`` so that `FlexFieldsSerializerMixin` can enforce the constraint. .. py:attribute:: permit_list_expands :type: list[str] :value: [] .. py:attribute:: action :type: str | None :value: None .. py:method:: get_serializer_context() -> dict[str, Any] Extend the serializer context with ``permitted_expands`` for list actions. When the current action is ``list``, adds ``context['permitted_expands']`` populated from ``permit_list_expands`` so the serializer can restrict expansion accordingly.