19 lines
650 B
Python
19 lines
650 B
Python
|
from rest_framework.views import APIView
|
||
|
from .models import Car
|
||
|
from rest_framework.response import Response
|
||
|
|
||
|
|
||
|
class CarViews(APIView):
|
||
|
def get(self, request, format=None):
|
||
|
"""
|
||
|
Returns car list based on fuzzy_logic filters.
|
||
|
"""
|
||
|
combustion = request.query_params.get('combustion')
|
||
|
mileage = request.query_params.get('mileage')
|
||
|
production_year = request.query_params.get('production_year')
|
||
|
engine_capacity = request.query_params.get('engine_capacity')
|
||
|
|
||
|
print(combustion, mileage, production_year, engine_capacity)
|
||
|
|
||
|
cars = list(Car.objects.all())
|
||
|
return Response(cars)
|