uncloud-mravi/uncloud_django_based/uncloud/uncloud_auth/serializers.py

16 lines
546 B
Python

from django.contrib.auth import get_user_model
from rest_framework import serializers
from uncloud import AMOUNT_DECIMALS, AMOUNT_MAX_DIGITS
class UserSerializer(serializers.ModelSerializer):
balance = serializers.DecimalField(max_digits=AMOUNT_MAX_DIGITS,
decimal_places=AMOUNT_DECIMALS)
class Meta:
model = get_user_model()
fields = ['username', 'email', 'balance', 'maximum_credit' ]
class ImportUserSerializer(serializers.Serializer):
username = serializers.CharField()