[1.8.x] Fixed #21588 -- Corrected handler initialization in "modifying upload handlers" example.
Backport of 8f50ff5b15a742f345dade0848a3fbbf2aff629d from master
This commit is contained in:
parent
0f12924eb5
commit
ba29dfb191
@ -184,7 +184,7 @@ For instance, suppose you've written a ``ProgressBarUploadHandler`` that
|
|||||||
provides feedback on upload progress to some sort of AJAX widget. You'd add this
|
provides feedback on upload progress to some sort of AJAX widget. You'd add this
|
||||||
handler to your upload handlers like this::
|
handler to your upload handlers like this::
|
||||||
|
|
||||||
request.upload_handlers.insert(0, ProgressBarUploadHandler())
|
request.upload_handlers.insert(0, ProgressBarUploadHandler(request))
|
||||||
|
|
||||||
You'd probably want to use ``list.insert()`` in this case (instead of
|
You'd probably want to use ``list.insert()`` in this case (instead of
|
||||||
``append()``) because a progress bar handler would need to run *before* any
|
``append()``) because a progress bar handler would need to run *before* any
|
||||||
@ -193,7 +193,7 @@ other handlers. Remember, the upload handlers are processed in order.
|
|||||||
If you want to replace the upload handlers completely, you can just assign a new
|
If you want to replace the upload handlers completely, you can just assign a new
|
||||||
list::
|
list::
|
||||||
|
|
||||||
request.upload_handlers = [ProgressBarUploadHandler()]
|
request.upload_handlers = [ProgressBarUploadHandler(request)]
|
||||||
|
|
||||||
.. note::
|
.. note::
|
||||||
|
|
||||||
@ -221,7 +221,7 @@ list::
|
|||||||
|
|
||||||
@csrf_exempt
|
@csrf_exempt
|
||||||
def upload_file_view(request):
|
def upload_file_view(request):
|
||||||
request.upload_handlers.insert(0, ProgressBarUploadHandler())
|
request.upload_handlers.insert(0, ProgressBarUploadHandler(request))
|
||||||
return _upload_file_view(request)
|
return _upload_file_view(request)
|
||||||
|
|
||||||
@csrf_protect
|
@csrf_protect
|
||||||
|
Loading…
x
Reference in New Issue
Block a user