med/media/serializers.py

65 lines
1.3 KiB
Python
Raw Normal View History

2019-08-17 10:12:10 +00:00
from rest_framework import serializers
2021-11-14 13:26:41 +00:00
from .models import Author, Borrow, CD, Comic, FutureMedium, Manga, Game, \
2021-10-23 16:31:03 +00:00
Novel, Review, Vinyl
2019-08-17 10:12:10 +00:00
2021-10-23 16:31:03 +00:00
class AuthorSerializer(serializers.ModelSerializer):
2019-08-17 10:12:10 +00:00
class Meta:
2021-10-23 16:31:03 +00:00
model = Author
2019-08-17 10:12:10 +00:00
fields = ['url', 'name']
2021-10-23 16:31:03 +00:00
class ComicSerializer(serializers.ModelSerializer):
2019-08-17 10:12:10 +00:00
class Meta:
2021-10-23 16:31:03 +00:00
model = Comic
2020-09-25 08:27:43 +00:00
fields = '__all__'
class MangaSerializer(serializers.ModelSerializer):
class Meta:
model = Manga
fields = '__all__'
class CDSerializer(serializers.ModelSerializer):
class Meta:
model = CD
fields = '__all__'
2021-10-23 16:31:03 +00:00
class VinylSerializer(serializers.ModelSerializer):
2020-09-25 08:27:43 +00:00
class Meta:
2021-10-23 16:31:03 +00:00
model = Vinyl
2020-09-25 08:27:43 +00:00
fields = '__all__'
2021-10-23 16:31:03 +00:00
class NovelSerializer(serializers.ModelSerializer):
2020-09-25 08:27:43 +00:00
class Meta:
2021-10-23 16:31:03 +00:00
model = Novel
2020-09-25 08:27:43 +00:00
fields = '__all__'
2021-10-23 16:31:03 +00:00
class ReviewSerializer(serializers.ModelSerializer):
2020-09-25 08:27:43 +00:00
class Meta:
2021-10-23 16:31:03 +00:00
model = Review
2020-09-25 08:27:43 +00:00
fields = '__all__'
2021-10-23 16:31:03 +00:00
class FutureMediumSerializer(serializers.ModelSerializer):
2020-09-25 08:27:43 +00:00
class Meta:
2021-10-23 16:31:03 +00:00
model = FutureMedium
2020-09-25 08:27:43 +00:00
fields = '__all__'
2019-08-17 10:12:10 +00:00
2021-11-14 13:26:41 +00:00
class BorrowSerializer(serializers.HyperlinkedModelSerializer):
2019-08-17 10:12:10 +00:00
class Meta:
2021-11-14 13:26:41 +00:00
model = Borrow
fields = '__all__'
2019-08-17 10:12:10 +00:00
2021-10-23 16:31:03 +00:00
class GameSerializer(serializers.HyperlinkedModelSerializer):
2019-08-17 10:12:10 +00:00
class Meta:
2021-10-23 16:31:03 +00:00
model = Game
2021-11-14 13:26:41 +00:00
fields = '__all__'