djangosnippets.org: Latest snippets posted by CarlosRodriguezhttps://djangosnippets.org/users/CarlosRodriguez/2014-06-25T06:40:08.157161-05:00CarlosRodriguezAdmin action for a "CSV Export" with ManyToManyField
2014-06-25T06:40:08.157161-05:00CarlosRodriguezhttps://djangosnippets.org/snippets/3076/<p>Based on <a href="https://djangosnippets.org/snippets/2369/">#2369</a></p>
<p>Save the snippet as actions.py within your django app, and then add an action on any model you want in it's ModelAdmin definition.</p>
<p>Example usage:</p>
<pre><code>from actions import export_as_csv_action
class YourModelAdmin(admin.ModelAdmin):
list_display = (...)
list_filter = [...]
actions = [export_as_csv_action("CSV Export", fields=[...])]
</code></pre>
Freely redistributable