Ticket #20331: admin-action-streaming.patch

File admin-action-streaming.patch, 1.6 KB (added by Edwin <django@…>, 22 months ago)
  • django/contrib/admin/options.py

    diff --git a/django/contrib/admin/options.py b/django/contrib/admin/options.py
    index e08cd9c..fed9b1c 100644
    a b from django.db.models.constants import LOOKUP_SEP 
    2121from django.db.models.related import RelatedObject
    2222from django.db.models.fields import BLANK_CHOICE_DASH, FieldDoesNotExist
    2323from django.db.models.sql.constants import QUERY_TERMS
    24 from django.http import Http404, HttpResponse, HttpResponseRedirect
     24from django.http import (Http404, HttpResponse, HttpResponseRedirect,
     25    StreamingHttpResponse)
    2526from django.shortcuts import get_object_or_404
    2627from django.template.response import SimpleTemplateResponse, TemplateResponse
    2728from django.utils.decorators import method_decorator
    class ModelAdmin(BaseModelAdmin): 
    959960
    960961            response = func(self, request, queryset)
    961962
    962             # Actions may return an HttpResponse, which will be used as the
    963             # response from the POST. If not, we'll be a good little HTTP
    964             # citizen and redirect back to the changelist page.
    965             if isinstance(response, HttpResponse):
     963            # Actions may return an HttpResponse or a StreamingHttpResponse,
     964            # which will be used as the response from the POST. If not, we'll
     965            # be a good little HTTP citizen and redirect back to the changelist
     966            # page.
     967            if isinstance(response, (HttpResponse, StreamingHttpResponse)):
    966968                return response
    967969            else:
    968970                return HttpResponseRedirect(request.get_full_path())
Back to Top