I was wondering what people are doing to format html snippets returned
via XHR.  I am currently using code  like:

response_dict = {}

t = ModelObject.objects.all()

html_table = render_to_response('table_template.html', {'table': t})

response_dict.update({'table': html_table})

return HttpResponse(simplejson.dumps(response_dict),
                            mimetype='application/javascript')

Where my template contains code to loop through the queryset and
layout the table appropriately.  I also do this with
form_for_model(instance) to layout the form fields.

This seems pretty appropriate to me, but as I am relatively new to
python and django, I was wondering if others are doing something
similar or if there are other suggestions for returning the html
formatted.
Thanks


--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to