>>> from itertools import combinations
>>> combinations([1, 2, 3], 2)
from django.http import JSONResponse
from django.views.generic import View
from .models import MyModel
class MyView(View):
def get(self, request, *args, **kwargs):
result = {'count': MyModel.objects.count()}
return JSONResponse(result)