Django REST Framework (DRF) is the de facto standard for building REST APIs with Django, and serializers are its core concept. A serializer converts complex data (model instances, querysets) to JSON for API responses, and converts incoming JSON back to validated Python objects — handling both serialization and validation, much like forms do for HTML.
ModelSerializer — the common case
rest_framework serializers
.models Article
(serializers.ModelSerializer):
:
model = Article
fields = [, , , , ]
read_only_fields = [, ]
