mirror of https://github.com/snachodog/mybuddy.git
62 lines
1.8 KiB
Python
62 lines
1.8 KiB
Python
# -*- coding: utf-8 -*-
|
|
from rest_framework import viewsets
|
|
|
|
from core import models
|
|
|
|
from . import serializers
|
|
|
|
|
|
class ChildViewSet(viewsets.ModelViewSet):
|
|
queryset = models.Child.objects.all()
|
|
serializer_class = serializers.ChildSerializer
|
|
lookup_field = 'slug'
|
|
filterset_fields = ('first_name', 'last_name', 'slug')
|
|
|
|
|
|
class DiaperChangeViewSet(viewsets.ModelViewSet):
|
|
queryset = models.DiaperChange.objects.all()
|
|
serializer_class = serializers.DiaperChangeSerializer
|
|
filterset_fields = ('child', 'wet', 'solid', 'color', 'amount')
|
|
|
|
|
|
class FeedingViewSet(viewsets.ModelViewSet):
|
|
queryset = models.Feeding.objects.all()
|
|
serializer_class = serializers.FeedingSerializer
|
|
filterset_fields = ('child', 'type', 'method')
|
|
|
|
|
|
class NoteViewSet(viewsets.ModelViewSet):
|
|
queryset = models.Note.objects.all()
|
|
serializer_class = serializers.NoteSerializer
|
|
filterset_fields = ('child',)
|
|
|
|
|
|
class SleepViewSet(viewsets.ModelViewSet):
|
|
queryset = models.Sleep.objects.all()
|
|
serializer_class = serializers.SleepSerializer
|
|
filterset_fields = ('child',)
|
|
|
|
|
|
class TemperatureViewSet(viewsets.ModelViewSet):
|
|
queryset = models.Temperature.objects.all()
|
|
serializer_class = serializers.TemperatureSerializer
|
|
filterset_fields = ('child',)
|
|
|
|
|
|
class TimerViewSet(viewsets.ModelViewSet):
|
|
queryset = models.Timer.objects.all()
|
|
serializer_class = serializers.TimerSerializer
|
|
filterset_fields = ('active', 'user')
|
|
|
|
|
|
class TummyTimeViewSet(viewsets.ModelViewSet):
|
|
queryset = models.TummyTime.objects.all()
|
|
serializer_class = serializers.TummyTimeSerializer
|
|
filterset_fields = ('child',)
|
|
|
|
|
|
class WeightViewSet(viewsets.ModelViewSet):
|
|
queryset = models.Weight.objects.all()
|
|
serializer_class = serializers.WeightSerializer
|
|
filterset_fields = ('child',)
|