Systemy-rozmyte-sql/backend/cars/views.py

19 lines
650 B
Python
Raw Normal View History

2022-01-03 00:09:16 +01:00
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)