On Sunday, 11 November 2012 23:51:44 UTC, HA wrote: > Hi Folks, > > I want to export data from my named tuple within my django html template. > Can someone please point me to an example or let me know how to accomplish > this? > I know how to get this done within my python script but this time I want > to get this done inside of my html template page. Basically I want to have > a button which says "Export to CSV" on html page and clicking on it exports > data (from a named tuple) to a csv > > Thanks, > Hemanshu >
This question makes no sense. Exporting data isn't something you do in a template, you do it in a view. Your template should just have a link to the view that does this. And what could it mean to have data in a "named tuple"? Assuming you mean collections.namedtuple, that's just a tuple with named fields, and is really only suitable for a small amount of data. How can you have enough data in a namedtuple to make it worth exporting to a CSV? -- DR. -- You received this message because you are subscribed to the Google Groups "Django users" group. To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/1_GqDAllMCAJ. 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.