From 215e04f75e691eac1cb864f2e8a8ad8e7488f4e4 Mon Sep 17 00:00:00 2001 From: redphix <113045766+redphix@users.noreply.github.com> Date: Sun, 11 Sep 2022 20:34:03 +0530 Subject: [PATCH] Fix error when query parameters not passed (#239) if no parameters are passed to `/api/book` then just return orders of ALL currency of ANY type. Currently, if no query parameters are passed, then the API returns 500 status code --- api/views.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/api/views.py b/api/views.py index 14f26886..a08cfb46 100644 --- a/api/views.py +++ b/api/views.py @@ -822,8 +822,8 @@ class BookView(ListAPIView): queryset = Order.objects.filter(status=Order.Status.PUB) def get(self, request, format=None): - currency = request.GET.get("currency") - type = request.GET.get("type") + currency = request.GET.get("currency", 0) + type = request.GET.get("type", 2) queryset = Order.objects.filter(status=Order.Status.PUB)