Login

Snippets by PatrickPorto

Snippet List

Generic Outputting CSV with Django

Save the snippet as actions.py within your core app, and then add an action on any model you want in it's ModelAdmin definition. Example usage: `from actions import export_as_csv_action` `class YourModelAdmin(admin.ModelAdmin):` ` list_display = ('field', 'get_field2')` ` actions = [export_to_csv(filename='your-model')]` ` def get_field2(self, obj):` ` return obj.field2`

  • admin
  • unicode
  • export
  • csv
  • action
Read More

PatrickPorto has posted 1 snippet.