i just added a csv export as an admin action from details here

django csv
http://docs.djangoproject.com/en/1.1/howto/outputting-csv/#howto-outputting-csv

admin actions
http://docs.djangoproject.com/en/1.1/ref/contrib/admin/actions/#ref-contrib-admin-actions



On Feb 17, 7:49 am, Shawn Milochik <sh...@milochik.com> wrote:
> Note: Your "novice Django skills" are irrelevant -- working with CSV files in 
> Django is nothing more than Python. Just check out the docs and examples on 
> the Python CSV module. You'll enjoy working with Python (and Django) a lot 
> more if you take the time to read a book or two, do tutorials, and generally 
> familiarize yourself with the language and framework. You'll also be a lot 
> better at it.
>
> The only "Django" bit to the whole thing is the download part. I'll give you 
> a few lines of code that I use to give the user an Excel file as a download 
> when they run a report. You should be able to easily modify it to serve a CSV 
> file.
>
>         xls_response = HttpResponse(mimetype="application/ms-excel")
>         xls_response['Content-Disposition'] = 'attachment; 
> filename=Reimbursement_Report_%s_to_%s.xls' % (start_date, end_date)
>
>         #note: 'xls' here is an Excel spreadsheet created by xlwt
>         xls.save(xls_response)
>         return xls_response
>
> Shawn

-- 
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.

Reply via email to