1
0
mirror of https://gitlab.crans.org/mediatek/med.git synced 2024-12-25 19:02:45 +00:00
med/users/serializers.py
Alexandre Iooss 6a79169496
Add REST API
2019-08-17 12:12:10 +02:00

19 lines
530 B
Python

from django.contrib.auth.models import Group
from rest_framework import serializers
from .models import User
class UserSerializer(serializers.HyperlinkedModelSerializer):
class Meta:
model = User
fields = ['url', 'username', 'first_name', 'last_name', 'email',
'groups', 'telephone', 'address', 'maxemprunt', 'comment',
'date_joined']
class GroupSerializer(serializers.HyperlinkedModelSerializer):
class Meta:
model = Group
fields = ['url', 'name']