Perfect, thanks On Jul 21, 4:50 pm, n3ph <n...@terminal21.de> wrote: > Definitely the better way.. > > On 07/21/10 23:42, Franklin Einspruch wrote: > > > Nick, > > > I think you're looking for this: > > >http://docs.djangoproject.com/en/dev/howto/outputting-csv/ > > > Franklin > > > On Wed, Jul 21, 2010 at 5:38 PM, Nick <nickt...@gmail.com> wrote: > >> I would like to format the output of a values_list into something a > >> little more usable for a CSV. > > >> My view is really simple > > >> def values_view(request) > >> list = MyModel.objects.values_list('id', 'name', 'type') > >> template = loader.get_template('mytemp.html') > >> c = Context({'list': list}) > >> html = t.render(c) > >> HttpResponse(html) > > >> my template looks like this > > >> {% for item in list %} > >> {{item}} > >> {% endfor %} > > >> it spits out a list of things like this: > > >> (u'id', u'name', u'type), (u'id2', u'name2', u'type2) > > >> etc. etc. > > >> How can I format a values_list so I could return something like a > >> table or csv? > > >> so: > > >> id, name, type > >> id2, name, type > > >> etc. etc. > > >> Thanks for the help > >> Nick > > >> -- > >> You received this message because you are subscribed to the Google Groups > >> "Django users" group. > >> To post to this group, send email to django-us...@googlegroups.com. > >> To unsubscribe from this group, send email to > >> django-users+unsubscr...@googlegroups.com. > >> For more options, visit this group > >> athttp://groups.google.com/group/django-users?hl=en. > > > > signature.asc > < 1KViewDownload
-- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@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.