susioma/api/views.py
2021-10-23 20:51:03 +02:00

9 lines
No EOL
275 B
Python

from django.views.generic import View
from django.http import JsonResponse
from buyer.models import Card
class AvailabilityView(View):
def get(self, request):
cards = len(Card.objects.filter(delivered__isnull=True))
return JsonResponse({"cards": cards})