Skip to content

VuedaListSerializer

Overview

List serializer for VuedaSerializer subclasses. Annotates the queryset with formatted_name when the child serializer's model has formatted_name_lookup_expression, mirroring the annotation that VuedaViewSet.get_queryset() applies for direct requests. This ensures formatted_name is populated even when objects are fetched via a related manager during expand (which bypasses the viewset queryset).

The annotate is skipped when formatted_name is already present in the queryset's annotations -- not only to avoid redundant work, but because annotating a queryset that is serving a prefetched relation clones it, discarding the cached prefetch result and forcing a fresh query per row. vueda.core.viewsets.build_prefetch_plan pre-annotates a to-many expand's Prefetch queryset for exactly this reason, so this check finds it already done.

to_representation

List of object instances -> List of dicts of primitive datatypes.

Signature

to_representation(self, data)

Parameters

NameTypeRequiredDescription
selfyes
datayes

Source

server/vueda/core/serializers/__init__.py:618

Source

server/vueda/core/serializers/__init__.py:603

Documents matching: server v3.0.0a1.post1client v3.0.0-alpha.2