diff --git a/api/views.py b/api/views.py index 38fef9b9..8a20c77c 100644 --- a/api/views.py +++ b/api/views.py @@ -1,3 +1,4 @@ +from re import T from rest_framework import status, viewsets from rest_framework.generics import CreateAPIView, ListAPIView from rest_framework.views import APIView @@ -349,9 +350,14 @@ class BookView(ListAPIView): currency = request.GET.get('currency') type = request.GET.get('type') - queryset = Order.objects.filter(status=Order.Status.PUB) - # Currency 0 and type 2 are special cases treated as "ANY". They are not possible choices. - if not (int(currency) == 0 and int(type) == 2): + queryset = Order.objects.filter(status=Order.Status.PUB) + + # Currency 0 and type 2 are special cases treated as "ANY". (These are not really possible choices) + if int(currency) == 0 and int(type) != 2: + queryset = Order.objects.filter(type=type, status=Order.Status.PUB) + elif int(type) == 2 and int(currency) != 0: + queryset = Order.objects.filter(currency=currency, status=Order.Status.PUB) + elif not (int(currency) == 0 and int(type) == 2): queryset = Order.objects.filter(currency=currency, type=type, status=Order.Status.PUB) if len(queryset)== 0: diff --git a/frontend/src/components/BookPage.js b/frontend/src/components/BookPage.js index 5a2b77a2..aa48d435 100644 --- a/frontend/src/components/BookPage.js +++ b/frontend/src/components/BookPage.js @@ -8,7 +8,7 @@ export default class BookPage extends Component { this.state = { orders: new Array(), currency: 0, - type: 2, + type: 1, currencies_dict: {"0":"ANY"} }; this.getCurrencyDict()