From 0508ba299c4f26ce6cbabd58af5692e04fa04d49 Mon Sep 17 00:00:00 2001 From: substantialnoninfringinguser Date: Sat, 23 May 2009 20:46:10 +0100 Subject: [PATCH] [svn] Fix mistakes in export admin actions. The python serializer only works on simple objects (lists, dicts etc) and not model instances so nix that part. --- expo/admin.py | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/expo/admin.py b/expo/admin.py index e2c2e49..dd1be90 100644 --- a/expo/admin.py +++ b/expo/admin.py @@ -97,25 +97,18 @@ admin.site.register(ScannedImage) def export_as_json(modeladmin, request, queryset): response = HttpResponse(mimetype="text/json") - response['Content-Disposition'] = 'attachment; filename=troggle_output.xml' + response['Content-Disposition'] = 'attachment; filename=troggle_output.json' serializers.serialize("json", queryset, stream=response) return response - def export_as_xml(modeladmin, request, queryset): response = HttpResponse(mimetype="text/xml") response['Content-Disposition'] = 'attachment; filename=troggle_output.xml' - return response - -def export_as_python(modeladmin, request, queryset): - response = HttpResponse(mimetype="text/python") - response['Content-Disposition'] = 'attachment; filename=troggle_output.py' - serializers.serialize("json", queryset, stream=response) + serializers.serialize("xml", queryset, stream=response) return response admin.site.add_action(export_as_xml) admin.site.add_action(export_as_json) -admin.site.add_action(export_as_python) try: mptt.register(Subcave, order_insertion_by=['name'])