thanks for the reply. In our course project it is a requirement to use
serialised data for CRUD and display it on the html page.But we are not
allowed to use the REST frameworks.I tried using return
Httpresponse(serialiseddata). But i dont know where to write the javascript
code

On Tue, Mar 6, 2012 at 9:28 PM, Ilian Iliev <il...@i-n-i.org> wrote:

> If you are returning json it seems more proper to me to parse it using
> JavaScript.
> Why exactly do you return json but not a normal dict/object?
>
> --
> eng. Ilian Iliev
> Web Software Developer
>
> Mobile: +359 88 66 08 400
> Website: http://ilian.i-n-i.org
>
>
>
> On Tue, Mar 6, 2012 at 9:14 PM, angel <alenb...@gmail.com> wrote:
>
>> 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 django-users@googlegroups.com.
>> To unsubscribe from this group, send email to
>> django-users+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/django-users?hl=en.
>>
>>
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to