2020-03-18 13:36:40 +00:00
|
|
|
from django.contrib.auth import get_user_model
|
|
|
|
from rest_framework import serializers
|
2020-03-18 13:53:26 +00:00
|
|
|
|
|
|
|
from uncloud import AMOUNT_DECIMALS, AMOUNT_MAX_DIGITS
|
2020-03-18 13:36:40 +00:00
|
|
|
|
|
|
|
class UserSerializer(serializers.ModelSerializer):
|
2020-03-18 13:53:26 +00:00
|
|
|
|
2020-04-18 13:11:02 +00:00
|
|
|
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()
|
2020-03-18 13:53:26 +00:00
|
|
|
fields = ['username', 'email', 'balance', 'maximum_credit' ]
|
2020-03-18 13:36:40 +00:00
|
|
|
|
2020-04-18 13:11:02 +00:00
|
|
|
class ImportUserSerializer(serializers.Serializer):
|
|
|
|
username = serializers.CharField()
|