Pydantic declares structured data with Python type hints, then helps Django Ninja serialize that data for API responses. Its class-based model resembles dataclasses, while remaining distinct from Django ORM models. section 11.2.1
For database objects, Ninja’s ModelSchema connects a Pydantic-style schema to a Django model. Choose the model and output fields, return the queryset, and let the API produce JSON. section 11.2.1
Serialize promoters
Define PromoterSchema with model=Promoter and fields for id, full_name, birth, and death. Declare the endpoint response as list[PromoterSchema], return Promoter.objects.all(), and receive a JSON list with dates and null for a missing death date.



