Skip to content

Instantly share code, notes, and snippets.

@TSKGunGun
Created October 28, 2021 07:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save TSKGunGun/2f8d12a16dc1035a5089f6d1bd6b2b46 to your computer and use it in GitHub Desktop.
Save TSKGunGun/2f8d12a16dc1035a5089f6d1bd6b2b46 to your computer and use it in GitHub Desktop.
def getdata(request):
products = []
for item in Product.objects.all:
product = {
"id" : item.id,
"name" : item.name
}
products.append(product)
dump_params = {
"enxure_ascii"=False
}
return JsonResponse(products, json_dumps_params=dump_params, safe=False)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment