Opened 3 months ago

Closed 3 months ago

#35534 closed Bug (invalid)

Request attribute upload handlers is immutable when method is POST

Reported by: matsony_15 Owned by: nobody
Component: Generic views Version: 5.0
Severity: Normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

Hi, this is copy of #35447. I`m trying to use custom upload handler as its mentioned ​here (https://docs.djangoproject.com/en/5.0/topics/http/file-uploads//), but when request method == POST upload_handlers atribute of request has type immutable list and throws an error. I created a test repo and provided some additional info in README.md here ​https://github.com/Smoooky/custom_upload_handler

Change History (2)

comment:1 by Sarah Boyce, 3 months ago

This feels like a duplicate of #26049

In the docs there is a note

You can only modify upload handlers before accessing request.POST or request.FILES – it doesn’t make sense to change upload handlers after upload handling has already started. If you try to modify request.upload_handlers after reading from request.POST or request.FILES Django will throw an error.

I suspect the issue is that you're accessing request.POST in the init of ProgressBarUploadHandler

If you want to discuss this further, I recommend taking this to the forum 👍

comment:2 by Sarah Boyce, 3 months ago

Resolution: invalid
Status: newclosed
Note: See TracTickets for help on using tickets.
Back to Top