# coding=utf-8

from rest_framework import viewsets
from .models import AirCondition, AirAverage
from .serializers import AirAverageSerializer, AirConditionSerializer


class AirConditionViewSets(viewsets.ReadOnlyModelViewSet):
    queryset = AirCondition.objects.all().order_by('-time')[:24]    # 24 hours
    serializer_class = AirConditionSerializer
# coding=utf-8

from rest_framework import viewsets
from .models import AirCondition, AirAverage
from .serializers import AirAverageSerializer, AirConditionSerializer


class AirConditionViewSets(viewsets.ReadOnlyModelViewSet):
    queryset = AirCondition.objects.all().order_by('-time')[:24]    # 24 hours
    serializer_class = AirConditionSerializer


class AirAverageViewSets(viewsets.ReadOnlyModelViewSet):
    queryset = AirAverage.objects.all().order_by('-from_time')[:10]     # 5 days
    serializer_class = AirAverageSerializer
Add pm2.5 avg view api