djangosnippets.org: Latest snippets tagged with 'admin-action'https://djangosnippets.org/tags/admin-action/2009-07-02T01:09:54.383504-05:00Export Related as JSON Admin Action
2009-07-02T01:09:54.383504-05:00johnboxallhttps://djangosnippets.org/snippets/1611/<p><a href="http://docs.djangoproject.com/en/dev/ref/contrib/admin/actions/#actions-that-provide-intermediate-pages">The Django Admin Action documentation leads you through exporting a queryset to JSON</a>. However exporting from a single model rarely tells the whole story.</p>
<p>Using the CollectObjects class, <code>export_related_as_json</code> gathers all instances related by foreign keys to what is being exported and exports them as well in a serialization …</p>
Freely redistributable