2017-08-13 13:44:48 +00:00
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
from __future__ import unicode_literals
|
|
|
|
|
|
|
|
from rest_framework import serializers
|
|
|
|
|
2017-08-13 20:48:16 +00:00
|
|
|
from core.models import Baby, DiaperChange, Feeding, Note, Sleep, TummyTime
|
2017-08-13 14:48:16 +00:00
|
|
|
|
|
|
|
|
|
|
|
class BabySerializer(serializers.HyperlinkedModelSerializer):
|
|
|
|
class Meta:
|
|
|
|
model = Baby
|
|
|
|
fields = ('first_name', 'last_name', 'birth_date')
|
|
|
|
|
|
|
|
|
2017-08-13 19:51:25 +00:00
|
|
|
class DiaperChangeSerializer(serializers.HyperlinkedModelSerializer):
|
|
|
|
class Meta:
|
|
|
|
model = DiaperChange
|
|
|
|
fields = ('baby', 'time', 'wet', 'solid', 'color')
|
|
|
|
|
|
|
|
|
2017-08-13 15:59:14 +00:00
|
|
|
class FeedingSerializer(serializers.HyperlinkedModelSerializer):
|
|
|
|
class Meta:
|
|
|
|
model = Feeding
|
|
|
|
fields = ('baby', 'start', 'end', 'duration', 'type', 'method')
|
|
|
|
|
|
|
|
|
2017-08-13 20:48:16 +00:00
|
|
|
class NoteSerializer(serializers.HyperlinkedModelSerializer):
|
|
|
|
class Meta:
|
|
|
|
model = Note
|
|
|
|
fields = ('baby', 'note', 'time')
|
|
|
|
|
|
|
|
|
2017-08-13 14:48:16 +00:00
|
|
|
class SleepSerializer(serializers.HyperlinkedModelSerializer):
|
|
|
|
class Meta:
|
|
|
|
model = Sleep
|
2017-08-13 15:20:09 +00:00
|
|
|
fields = ('baby', 'start', 'end', 'duration')
|
2017-08-13 15:59:14 +00:00
|
|
|
|
|
|
|
|
2017-08-13 19:05:44 +00:00
|
|
|
class TummyTimeSerializer(serializers.HyperlinkedModelSerializer):
|
|
|
|
class Meta:
|
|
|
|
model = TummyTime
|
|
|
|
fields = ('baby', 'start', 'end', 'duration', 'milestone')
|