1serialization in django
2
3from rest_framework import serializers
4from .models import Product
5
6class ProductSerializers(serializers.ModelSerializer):
7 class Meta:
8 model = Product
9 fields = '__all__'
10
11# Serializers allow complex data such as querysets and model instances to be converted to native Python datatypes that can then be easily rendered into JSON, XML or other content types.
12# Serializers also provide deserialization, allowing parsed data to be converted back into complex types, after first validating the incoming data.