Skip to content

Instantly share code, notes, and snippets.

@TSKGunGun
Created October 28, 2021 07:39
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/fb9ff164b1f819eeb69e3f3fd3ce624d to your computer and use it in GitHub Desktop.
Save TSKGunGun/fb9ff164b1f819eeb69e3f3fd3ce624d 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)
return JsonResponse(json.dumps(products, enxure_ascii=False), safe=False)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment