serializer.py 470 B

1234567891011121314151617
  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. class Meta:
  11. model = UserProfile
  12. fields = ['user', 'wallet', 'visits']