use requests via cast as drf requires
This commit is contained in:
@@ -1,4 +1,6 @@
|
|||||||
from rest_framework import generics
|
from rest_framework import generics
|
||||||
|
from typing import cast
|
||||||
|
from rest_framework.request import Request
|
||||||
from routes.models import Route
|
from routes.models import Route
|
||||||
from .serializers import SearchRouteSerializer
|
from .serializers import SearchRouteSerializer
|
||||||
from api.utils.pagination import StandardResultsSetPagination
|
from api.utils.pagination import StandardResultsSetPagination
|
||||||
@@ -12,8 +14,8 @@ class SearchRouteListView(generics.ListAPIView):
|
|||||||
|
|
||||||
def get_queryset(self):
|
def get_queryset(self):
|
||||||
owner_type = self.kwargs.get('owner_type')
|
owner_type = self.kwargs.get('owner_type')
|
||||||
from_city = self.request.query_params.get('from')
|
from_city = cast(Request, self.request).query_params.get('from')
|
||||||
to_city = self.request.query_params.get('to')
|
to_city = cast(Request, self.request).query_params.get('to')
|
||||||
|
|
||||||
valid_types = [choice[0] for choice in owner_type_choices]
|
valid_types = [choice[0] for choice in owner_type_choices]
|
||||||
current_time = timezone.now()
|
current_time = timezone.now()
|
||||||
|
|||||||
Reference in New Issue
Block a user