You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

54 lines
1.1 KiB

from rest_framework import serializers
from apps.payment.models import AuthorBalance
from .user import UserSerializer
class AuthorBalanceCreateSerializer(serializers.ModelSerializer):
class Meta:
model = AuthorBalance
fields = (
'id',
'author',
'type',
'amount',
'commission',
'status',
'payment',
'cause',
)
read_only_fields = (
'id',
'author',
'type',
'payment',
)
def to_representation(self, instance):
return AuthorBalanceSerializer(instance, context=self.context).to_representation(instance)
class AuthorBalanceSerializer(serializers.ModelSerializer):
author = UserSerializer()
class Meta:
model = AuthorBalance
fields = (
'id',
'author',
'type',
'amount',
'commission',
'status',
'payment',
'cause',
)
read_only_fields = (
'id',
'author',
'type',
'payment',
)