1pip install djangorestframework
2pip install markdown # Markdown support for the browsable API.
3pip install django-filter # Filtering support
1pip install djangorestframework
2pip install markdown # Markdown support for the browsable API.
3pip install django-filter # Filtering support
1from django.contrib.auth.models import User, Group
2from rest_framework import serializers
3
4
5class UserSerializer(serializers.HyperlinkedModelSerializer):
6 class Meta:
7 model = User
8 fields = ['url', 'username', 'email', 'groups']
9
10
11class GroupSerializer(serializers.HyperlinkedModelSerializer):
12 class Meta:
13 model = Group
14 fields = ['url', 'name']