Created
October 28, 2021 08:04
-
-
Save TSKGunGun/af83f9e23b71f468c8b2102a37b3ebc2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def getdata(request): | |
products = [] | |
for item in Product.objects.all: | |
product = { | |
"id" : item.id, | |
"name" : item.name | |
} | |
products.append(product) | |
jsondata = json.dumps(products, enxure_ascii=False) | |
return HttpResponse(jsondata, content_type="application/json") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment