forked from uncloud/uncloud
028fd6789f
Signed-off-by: Nico Schottelius <nico@nico-notebook.schottelius.org>
27 lines
803 B
Python
27 lines
803 B
Python
from django.contrib.auth import get_user_model
|
|
from rest_framework import serializers
|
|
from .models import Bill, Payment, Order
|
|
|
|
class BillSerializer(serializers.ModelSerializer):
|
|
class Meta:
|
|
model = Bill
|
|
fields = ['owner', 'amount', 'due_date', 'creation_date',
|
|
'starting_date', 'ending_date', 'paid']
|
|
|
|
class PaymentSerializer(serializers.ModelSerializer):
|
|
class Meta:
|
|
model = Payment
|
|
fields = ['owner', 'amount', 'source', 'timestamp']
|
|
|
|
class OrderSerializer(serializers.ModelSerializer):
|
|
class Meta:
|
|
model = Order
|
|
fields = '__all__'
|
|
|
|
class UserSerializer(serializers.ModelSerializer):
|
|
class Meta:
|
|
model = get_user_model()
|
|
fields = ['username', 'email']
|
|
|
|
def get_balance(self, obj):
|
|
return 666
|