added object count to my_products

This commit is contained in:
Sam
2021-03-05 10:13:31 +00:00
parent e7366226ea
commit f81bbee4e6
2 changed files with 9 additions and 3 deletions

View File

@@ -68,7 +68,11 @@ def my_products(request):
elif limit is not None:
limit = int(limit)
data = data[:limit]
return Response(data=data)
# prepare response payload
payload = {}
payload['results'] = data
payload['count'] = len(payload['results'])
return Response(data=payload)
@api_view(['POST',])