12ebe31cf5
- filters plants based on ecological region and soil order
21 lines
No EOL
684 B
Python
21 lines
No EOL
684 B
Python
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
|
|
|