Ce serveur Gitlab sera éteint le 30 juin 2020, pensez à migrer vos projets vers les serveurs gitlab-research.centralesupelec.fr et gitlab-student.centralesupelec.fr !

serializers.py 1.55 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
# Re2o est un logiciel d'administration développé initiallement au rezometz. Il
# se veut agnostique au réseau considéré, de manière à être installable en
# quelques clics.
#
# Copyright © 2017  Gabriel Détraz
# Copyright © 2017  Goulven Kermarec
# Copyright © 2017  Augustin Lemesle
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.

23
# Maël Kervella
24

25 26 27 28
"""users.serializers
Serializers for the User app
"""

29
from rest_framework import serializers
30
from users.models import Club, Adherent
31

32

33
class MailingSerializer(serializers.ModelSerializer):
34 35
    """ Serializer to build Mailing objects """

36 37 38 39 40 41
    name = serializers.CharField(source='pseudo')

    class Meta:
        model = Club
        fields = ('name',)

42

43
class MailingMemberSerializer(serializers.ModelSerializer):
44 45 46
    """ Serializer fot the Adherent objects (who belong to a
    Mailing) """

47
    class Meta:
48
        model = Adherent
49
        fields = ('email',)