Commit 84775f99 authored by Hamza Dely's avatar Hamza Dely

[consos/serializers] Impléméntation des sérialiseurs pour les boutons et les transactions

parent f5a744b8
......@@ -6,7 +6,7 @@ from rest_framework import serializers
from note_kfet.serializers import mixins
from consos.models import Note
from consos.models import Note, Bouton, Transaction
class NoteRechercheSerializer(serializers.Serializer):
"""
......@@ -22,7 +22,6 @@ class NoteSerializer(mixins.DynamicFieldsMixin, serializers.ModelSerializer):
"""
Sérialiseur pour les objets Note
"""
#aliases = serializers.SlugRelatedField(slug_field="adherent__aliases__alias", many=True, read_only=True)
class Meta:
model = Note
fields = [
......@@ -31,3 +30,27 @@ class NoteSerializer(mixins.DynamicFieldsMixin, serializers.ModelSerializer):
]
read_only_fields = ['adherent']
default_empty = False
class BoutonSerializer(serializers.ModelSerializer):
"""
Sérialiseur pour les objets Bouton
"""
class Meta:
model = Bouton
fields = [
'id', 'etiquette', 'description', 'categorie',
'montant', 'credite', 'actif',
]
read_only_fields = ['id', 'actif']
class TransactionSerializer(serializers.ModelSerializer):
"""
Sérialiseur pour les transactions
"""
class Meta:
model = Transaction
fields = [
'id', 'date', 'action', 'moyen', 'quantite', 'montant',
'categorie', 'description', 'valide', 'emetteur', 'destinataire',
]
read_only_fields = ['id']
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment