1
0
mirror of https://gitlab.crans.org/mediatek/med.git synced 2024-11-26 18:07:10 +00:00
med/media/serializers.py

67 lines
1.5 KiB
Python

from rest_framework import serializers
from .models import Author, CD, Comic, FutureMedium, Manga, Emprunt, 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 EmpruntSerializer(serializers.HyperlinkedModelSerializer):
class Meta:
model = Emprunt
fields = ['url', 'media', 'user', 'date_emprunt', 'date_rendu',
'permanencier_emprunt', 'permanencier_rendu']
class GameSerializer(serializers.HyperlinkedModelSerializer):
class Meta:
model = Game
fields = ['url', 'name', 'proprietaire', 'duree', 'nombre_joueurs_min',
'nombre_joueurs_max', 'comment']