django-orchestra-test/orchestra/apps/bills/serializers.py
2014-08-22 11:28:46 +00:00

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'
)