mirror of
https://gitlab.crans.org/mediatek/med.git
synced 2024-11-26 22:47:09 +00:00
32 lines
973 B
Python
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']
|