2017-08-13 13:44:48 +00:00
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
from rest_framework import viewsets
|
|
|
|
|
2017-11-10 02:15:09 +00:00
|
|
|
from core import models
|
2017-08-16 22:33:02 +00:00
|
|
|
|
2017-11-10 02:15:09 +00:00
|
|
|
from . import serializers
|
2017-08-13 14:48:16 +00:00
|
|
|
|
|
|
|
|
2017-08-16 12:49:58 +00:00
|
|
|
class ChildViewSet(viewsets.ModelViewSet):
|
2017-11-10 02:15:09 +00:00
|
|
|
queryset = models.Child.objects.all()
|
|
|
|
serializer_class = serializers.ChildSerializer
|
2017-08-18 12:08:23 +00:00
|
|
|
lookup_field = 'slug'
|
2018-08-04 20:00:51 +00:00
|
|
|
filterset_fields = ('first_name', 'last_name', 'slug')
|
2017-08-13 20:15:57 +00:00
|
|
|
|
2017-08-13 14:48:16 +00:00
|
|
|
|
2017-08-13 19:51:25 +00:00
|
|
|
class DiaperChangeViewSet(viewsets.ModelViewSet):
|
2017-11-10 02:15:09 +00:00
|
|
|
queryset = models.DiaperChange.objects.all()
|
|
|
|
serializer_class = serializers.DiaperChangeSerializer
|
2020-01-26 22:30:00 +00:00
|
|
|
filterset_fields = ('child', 'wet', 'solid', 'color', 'amount')
|
2017-08-13 20:15:57 +00:00
|
|
|
|
2017-08-13 19:51:25 +00:00
|
|
|
|
2017-08-13 15:59:14 +00:00
|
|
|
class FeedingViewSet(viewsets.ModelViewSet):
|
2017-11-10 02:15:09 +00:00
|
|
|
queryset = models.Feeding.objects.all()
|
|
|
|
serializer_class = serializers.FeedingSerializer
|
2018-08-04 20:00:51 +00:00
|
|
|
filterset_fields = ('child', 'type', 'method')
|
2017-08-13 20:15:57 +00:00
|
|
|
|
2017-08-13 15:59:14 +00:00
|
|
|
|
2017-08-13 20:48:16 +00:00
|
|
|
class NoteViewSet(viewsets.ModelViewSet):
|
2017-11-10 02:15:09 +00:00
|
|
|
queryset = models.Note.objects.all()
|
|
|
|
serializer_class = serializers.NoteSerializer
|
2018-08-04 20:00:51 +00:00
|
|
|
filterset_fields = ('child',)
|
2017-08-13 20:48:16 +00:00
|
|
|
|
|
|
|
|
2017-08-13 14:48:16 +00:00
|
|
|
class SleepViewSet(viewsets.ModelViewSet):
|
2017-11-10 02:15:09 +00:00
|
|
|
queryset = models.Sleep.objects.all()
|
|
|
|
serializer_class = serializers.SleepSerializer
|
2018-08-04 20:00:51 +00:00
|
|
|
filterset_fields = ('child',)
|
2017-08-13 20:15:57 +00:00
|
|
|
|
2017-08-13 15:59:14 +00:00
|
|
|
|
2019-05-17 05:13:14 +00:00
|
|
|
class TemperatureViewSet(viewsets.ModelViewSet):
|
|
|
|
queryset = models.Temperature.objects.all()
|
|
|
|
serializer_class = serializers.TemperatureSerializer
|
|
|
|
filterset_fields = ('child',)
|
|
|
|
|
|
|
|
|
2017-08-16 22:33:02 +00:00
|
|
|
class TimerViewSet(viewsets.ModelViewSet):
|
2017-11-10 02:15:09 +00:00
|
|
|
queryset = models.Timer.objects.all()
|
|
|
|
serializer_class = serializers.TimerSerializer
|
2018-08-04 20:00:51 +00:00
|
|
|
filterset_fields = ('active', 'user')
|
2017-08-16 22:33:02 +00:00
|
|
|
|
|
|
|
|
2017-08-13 19:05:44 +00:00
|
|
|
class TummyTimeViewSet(viewsets.ModelViewSet):
|
2017-11-10 02:15:09 +00:00
|
|
|
queryset = models.TummyTime.objects.all()
|
|
|
|
serializer_class = serializers.TummyTimeSerializer
|
2018-08-04 20:00:51 +00:00
|
|
|
filterset_fields = ('child',)
|
2017-11-10 02:15:09 +00:00
|
|
|
|
|
|
|
|
|
|
|
class WeightViewSet(viewsets.ModelViewSet):
|
|
|
|
queryset = models.Weight.objects.all()
|
|
|
|
serializer_class = serializers.WeightSerializer
|
2018-08-04 20:00:51 +00:00
|
|
|
filterset_fields = ('child',)
|