1
0
mirror of https://gitlab.crans.org/mediatek/med.git synced 2024-11-27 04:13:02 +00:00
med/media/serializers.py
2020-05-22 18:04:41 +02:00

32 lines
967 B
Python

from rest_framework import serializers
from .models import Auteur, BD, Emprunt, Jeu
class AuteurSerializer(serializers.HyperlinkedModelSerializer):
class Meta:
model = Auteur
fields = ['url', 'name']
class MediaSerializer(serializers.HyperlinkedModelSerializer):
class Meta:
model = BD
fields = ['url', 'isbn', 'title', 'subtitle', 'external_url',
'side_identifier', 'authors', 'number_of_pages',
'publish_date']
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']