serializer.py
400 Bytes
from .models import Video, Tags
from rest_framework import serializers
class VideoSerializer(serializers.ModelSerializer):
class Meta:
model = Video
fields = '__all__'
class TagSerializer(serializers.ModelSerializer):
class Meta:
model = Tags
fields = '__all__'
#dict화 방법
#serializer = VideoSerializer(Video.objects.all(), many=True)
#serializer.data