-
Notifications
You must be signed in to change notification settings - Fork 103
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
FileFields in deeply nested inlines broken in Django 2.1 #111
Comments
For the model with the file field, is that the only field on the form? Or are there other fields in the same inline? If, for instance, there is a charfield, try filling out that field and uploading a file at the same time, to see if that works. If the adjacent charfield saves but the file doesn't upload, that will suggest one issue. If they both save, however, then I have a theory for why that might be (and so, how I would fix it). |
It was the only field, but I added a text field to test. Interestingly, the form now fails to validate highlighting the Image field and showing "This field is required", as if it doesn't see the file upload at all. |
Ok, tracked it down a bit. The issue is that Django admin doesn't set 'multipart/form-data' on the HTML form if none of the fields it knows about in the formsets it knows about need multipart. The relevant code bit is in contrib/admin/options.py in render_change_form.
|
Oh interesting. Looks like this logic got added in Django 2.1. I'll see what I can do for a general fix. |
I think you need to reoppen, for I don't see it working I had to set in my parent form is_multipart method that returns true to make it work I could only see first level of inlines being checked from debugger |
also noticed that same goes with obj given to get_read_only_fields e.t.c. it is just first level inline object |
Image uploading in the first inline level works fine, but in the second level it gets ignored. Nothing fails and the rest of the formsets get saved fine, but the file upload doesn't happen, the file is not in the server, and the corresponding entry in the database is not stored.
BTW, this is using Django 2.1 and code like the following:
The text was updated successfully, but these errors were encountered: