Skip to content

Instantly share code, notes, and snippets.

@gabrielloliveira
Created May 29, 2021 00:48
Show Gist options
  • Save gabrielloliveira/e89d2d92c3da25fa61d02a81c0cb31ab to your computer and use it in GitHub Desktop.
Save gabrielloliveira/e89d2d92c3da25fa61d02a81c0cb31ab to your computer and use it in GitHub Desktop.
import datetime
import uuid
from decimal import Decimal
from rest_framework import generics
from rest_framework.response import Response
def fake_some_model_data() -> dict:
return {
"uuid": str(uuid.uuid4()),
"name": "Algum nome aleatório bem grande",
"email": "algumemailaleatorio@email.com",
"birthday": datetime.date(2021, 5, 28),
"is_premium": True,
"cash": Decimal(957.78),
"invoice_date": 28,
}
class IndexList(generics.ListAPIView):
def get(self, request, *args, **kwargs):
some_big_query_data = []
for _ in range(1000000):
some_big_query_data.append(fake_some_model_data())
return Response(some_big_query_data)
index = IndexList.as_view()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment