right-tree/backend/right_tree/api/views.py

21 lines
684 B
Python
Raw Normal View History

from rest_framework import viewsets
from right_tree.api.models import Plant
from right_tree.api.serializers import PlantSerializer
from .filters import coordinate_filter
class PlantViewSet(viewsets.ModelViewSet):
"""
API endpoint that allows hours to be grouped or edited.
"""
queryset = Plant.objects.all()
serializer_class = PlantSerializer
def get_queryset(self):
""" Filtering plant query set by query parameters in the URL.
(May want to eventually use django filters to break up the logic...)
"""
queryset = Plant.objects.all()
queryset = coordinate_filter(self.request, queryset)
return queryset