django-orchestra/orchestra/apps/bills/serializers.py
2014-09-30 16:39:47 +00:00

23 lines
588 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', 'type', 'total', 'is_sent', 'created_on', 'due_on',
'comments', 'html', 'lines'
)