1
0
mirror of https://gitlab.crans.org/mediatek/med.git synced 2024-12-25 17:42:25 +00:00
med/media/serializers.py
2019-08-19 12:17:49 +02:00

32 lines
973 B
Python

from rest_framework import serializers
from .models import Auteur, Emprunt, Jeu, Media
class AuteurSerializer(serializers.HyperlinkedModelSerializer):
class Meta:
model = Auteur
fields = ['url', 'name']
class MediaSerializer(serializers.HyperlinkedModelSerializer):
class Meta:
model = Media
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']