- July 2, 2009
- serialize admin json export admin-action
- 2 (after 2 ratings)
The Django Admin Action documentation leads you through exporting a queryset to JSON. However exporting from a single model rarely tells the whole story.
Using the CollectObjects class,
export_related_as_json gathers all instances related by foreign keys to what is being exported and exports them as well in a serialization bonanza.
Use it to export Users and you'll get their Profile objects as well!
# admin.py from django.contrib import admin admin.site.add_action(export_related_as_json)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
More like this
- Automatically setup raw_id_fields ForeignKey & OneToOneField by agusmakmun 5 months, 1 week ago
- Crispy Form by sourabhsinha396 6 months ago
- ReadOnlySelect by mkoistinen 6 months, 2 weeks ago
- Verify events sent to your webhook endpoints by santos22 7 months, 2 weeks ago
- Django Language Middleware by agusmakmun 7 months, 3 weeks ago