I am new to django and doing my course project. I am searching for a
solution for iterating JSON dictionary in html page. My django view
is the following:
def do_GET(self, offset):
data=get_object_or_404(NewAuction,pk=offset)
context=serializers.serialize("json",[data])
data1=json.dumps(context)
return render_to_response("index.html",{"data1":data1})
NewAuction is the model and offset is the particular id.
Now I want to display the dictionary using the variable data1 in
html.I use {{data1}} for this. but I got the following
"[{\"pk\": 5, \"model\": \"Auction.newauction\", \"fields\":
{\"username\": 1, \"category\": \"furniture\", \"description\": \"Made
of Wood\", \"end_date\": \"2012-05-01 11:00:00\", \"start_price\":
\"100\", \"title\": \"Table\", \"start_date\": \"2012-03-04
11:24:11\"}}]"
How I can iterate it for displaying like
category:furniture
description:Made of wood
....................................
......................................
like this.
Is anyone can help me?
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en.