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

23 lines
583 B
Python
Raw Normal View History

2014-07-23 16:24:56 +00:00
from rest_framework import serializers
from orchestra.apps.accounts.serializers import AccountSerializerMixin
2014-07-23 16:24:56 +00:00
from .models import Bill, BillLine
class BillLineSerializer(serializers.HyperlinkedModelSerializer):
class Meta:
model = BillLine
class BillSerializer(AccountSerializerMixin, serializers.HyperlinkedModelSerializer):
2014-07-23 16:24:56 +00:00
lines = BillLineSerializer(source='billlines')
class Meta:
model = Bill
fields = (
2014-08-22 11:28:46 +00:00
'url', 'number', 'bill_type', 'status', 'created_on', 'due_on',
'comments', 'html', 'lines'
)