Login

Snippets by dek

Snippet List

Generic csv export admin action

A generic admin action to export selected objects as csv file. The csv file contains a first line with header information build from the models field names followed by the actual data rows. Access is limited to staff users. Requires django-1.1. **Usage:** Add the code to your project, e.g. a file called actions.py in the project root. Register the action in your apps admin.py: from myproject.actions import export_as_csv class MyAdmin(admin.ModelAdmin): actions = [export_as_csv]

  • admin
  • generic
  • export
  • csv
  • action
Read More
Author: dek
  • 7
  • 9

dek has posted 1 snippet.