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

17 lines
546 B
Python
Raw Normal View History

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