serializer.py 434 B

12345678910111213141516
  1. from django.contrib.auth.models import User
  2. from rest_framework import serializers
  3. from django.contrib.auth.models import User
  4. from .models import UserProfile
  5. class UserSerializer(serializers.ModelSerializer):
  6. class Meta:
  7. model = User
  8. fields = ['id', 'username', 'first_name', 'last_name','email']
  9. class UserProfileSerializer(serializers.ModelSerializer):
  10. model = UserProfile
  11. fields = ['name']