Fixed a small error in the docs that I missed from [10408].
git-svn-id: http://code.djangoproject.com/svn/django/trunk@10409 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
bb15cee58a
commit
07465b635d
|
@ -201,7 +201,7 @@ objects as JSON::
|
||||||
from django.http import HttpResponse
|
from django.http import HttpResponse
|
||||||
from django.core import serializers
|
from django.core import serializers
|
||||||
|
|
||||||
def export_as_json(request, queryset):
|
def export_as_json(modeladmin, request, queryset):
|
||||||
response = HttpResponse(mimetype="text/javascript")
|
response = HttpResponse(mimetype="text/javascript")
|
||||||
serialize.serialize(queryset, stream=response)
|
serialize.serialize(queryset, stream=response)
|
||||||
return response
|
return response
|
||||||
|
@ -220,7 +220,7 @@ that simply redirects to your custom export view::
|
||||||
from django.contrib.contenttypes.models import ContentType
|
from django.contrib.contenttypes.models import ContentType
|
||||||
from django.http import HttpResponseRedirect
|
from django.http import HttpResponseRedirect
|
||||||
|
|
||||||
def export_selected_objects(request, queryset):
|
def export_selected_objects(modeladmin, request, queryset):
|
||||||
selected = request.POST.getlist(admin.ACTION_CHECKBOX_NAME)
|
selected = request.POST.getlist(admin.ACTION_CHECKBOX_NAME)
|
||||||
ct = ContentType.objects.get_for_model(queryset.model)
|
ct = ContentType.objects.get_for_model(queryset.model)
|
||||||
return HttpResponseRedirect("/export/?ct=%s&ids=%s" % (ct.pk, ",".join(selected)))
|
return HttpResponseRedirect("/export/?ct=%s&ids=%s" % (ct.pk, ",".join(selected)))
|
||||||
|
|
Loading…
Reference in New Issue