1234567891011121314151617181920212223242526 |
- from rest_framework import serializers
- from access.models import User
- class UserSerializer(serializers.ModelSerializer):
- class Meta:
- model = User
- fields = ["uuid","name","email", "password", "created_at"]
- extra_kwargs = {'password': {"write_only": True}}
- read_only_fields = [
- "uuid",
- "created_at",
- ]
- class UserUpdateSerializer(serializers.ModelSerializer):
- class Meta:
- model = User
- fields = ["uuid", "email","name", "gender", "birthdate", "avatar",]
- read_only_fields = [
- "uuid", "email"
- ]
- class UserPublicSerializer(serializers.ModelSerializer):
- class Meta:
- model = User
- fields = ["uuid", "email",]
- read_only_fields = ["uuid",]
|