django-orchestra/orchestra/apps/bills/serializers.py

23 lines
583 B
Python

from rest_framework import serializers
from orchestra.apps.accounts.serializers import AccountSerializerMixin
from .models import Bill, BillLine
class BillLineSerializer(serializers.HyperlinkedModelSerializer):
class Meta:
model = BillLine
class BillSerializer(AccountSerializerMixin, serializers.HyperlinkedModelSerializer):
lines = BillLineSerializer(source='billlines')
class Meta:
model = Bill
fields = (
'url', 'number', 'bill_type', 'status', 'created_on', 'due_on',
'comments', 'html', 'lines'
)