med/media/serializers.py

65 lines
1.3 KiB
Python

from rest_framework import serializers
from .models import Author, Borrow, CD, Comic, FutureMedium, Manga, Game, \
Novel, Review, Vinyl
class AuthorSerializer(serializers.ModelSerializer):
class Meta:
model = Author
fields = ['url', 'name']
class ComicSerializer(serializers.ModelSerializer):
class Meta:
model = Comic
fields = '__all__'
class MangaSerializer(serializers.ModelSerializer):
class Meta:
model = Manga
fields = '__all__'
class CDSerializer(serializers.ModelSerializer):
class Meta:
model = CD
fields = '__all__'
class VinylSerializer(serializers.ModelSerializer):
class Meta:
model = Vinyl
fields = '__all__'
class NovelSerializer(serializers.ModelSerializer):
class Meta:
model = Novel
fields = '__all__'
class ReviewSerializer(serializers.ModelSerializer):
class Meta:
model = Review
fields = '__all__'
class FutureMediumSerializer(serializers.ModelSerializer):
class Meta:
model = FutureMedium
fields = '__all__'
class BorrowSerializer(serializers.HyperlinkedModelSerializer):
class Meta:
model = Borrow
fields = '__all__'
class GameSerializer(serializers.HyperlinkedModelSerializer):
class Meta:
model = Game
fields = '__all__'