med/media/serializers.py

66 lines
1.5 KiB
Python

from rest_framework import serializers
from .models import Auteur, BD, CD, FutureMedia, Manga, Emprunt, Jeu, Revue, Roman, Vinyle
class AuteurSerializer(serializers.ModelSerializer):
class Meta:
model = Auteur
fields = ['url', 'name']
class BDSerializer(serializers.ModelSerializer):
class Meta:
model = BD
fields = '__all__'
class MangaSerializer(serializers.ModelSerializer):
class Meta:
model = Manga
fields = '__all__'
class CDSerializer(serializers.ModelSerializer):
class Meta:
model = CD
fields = '__all__'
class VinyleSerializer(serializers.ModelSerializer):
class Meta:
model = Vinyle
fields = '__all__'
class RomanSerializer(serializers.ModelSerializer):
class Meta:
model = Roman
fields = '__all__'
class RevueSerializer(serializers.ModelSerializer):
class Meta:
model = Revue
fields = '__all__'
class FutureMediaSerializer(serializers.ModelSerializer):
class Meta:
model = FutureMedia
fields = '__all__'
class EmpruntSerializer(serializers.HyperlinkedModelSerializer):
class Meta:
model = Emprunt
fields = ['url', 'media', 'user', 'date_emprunt', 'date_rendu',
'permanencier_emprunt', 'permanencier_rendu']
class JeuSerializer(serializers.HyperlinkedModelSerializer):
class Meta:
model = Jeu
fields = ['url', 'name', 'proprietaire', 'duree', 'nombre_joueurs_min',
'nombre_joueurs_max', 'comment']