Changes between Initial Version and Version 1 of Ticket #27150, comment 11
- Timestamp:
- Mar 24, 2026, 7:33:23 AM (2 weeks ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Ticket #27150, comment 11
initial v1 8 8 || [https://github.com/django/django/blob/main/django/db/models/fields/files.py#L336 fields/files.py:336] `pre_save` || 847 || Skip committing the file if the field is empty (name is the DB value; empty name means nothing to save) || FieldFile || 9 9 || [https://github.com/django/django/blob/main/django/db/models/fields/files.py#L42 fields/files.py:42] `_require_file` || 85 || Guard: raise `ValueError` if no file is associated with this field before attempting file operations || FieldFile || 10 || [https://github.com/django/django/blob/main/django/http/multipartparser.py#L374 http/multipartparser.py:374] `handle_file_complete` || 59 || Check whether an upload handler returned a completed file object (vs `None` meaning not yet done) || InMemoryUploadedFile, TemporaryUploadedFile ||10 || [https://github.com/django/django/blob/main/django/http/multipartparser.py#L374 http/multipartparser.py:374] `handle_file_complete` || 59 || Check whether an upload handler returned a completed file object (vs `None` meaning not yet done) '''*''' || InMemoryUploadedFile, TemporaryUploadedFile || 11 11 || [https://github.com/django/django/blob/main/django/forms/fields.py#L696 forms/fields.py:696] `FileField.clean` || 37 || Fall back to the initial value if no new file was uploaded || FieldFile, SimpleUploadedFile || 12 12 || [https://github.com/django/django/blob/main/django/forms/widgets.py#L552 forms/widgets.py:552] `ClearableFileInput.is_initial` || 24 || Determine whether the current value is an existing stored file (to decide whether to render the "currently" link) || FieldFile, SimpleUploadedFile || … … 30 30 The docs don't really then need updating at all, you could make a case for documenting the `__bool__` behaviour of FieldFile and UploadedFile but I think you'd be fine without it. 31 31 32 I think we should close and pause the current PR and instead movethis ticket back to unreviewed, so a member of the triage team can have a think about it.32 I think we should close and pause the current PR and instead I've moved this ticket back to unreviewed, so a member of the triage team can have a think about it. 33 33 34 34 ---- 35 '''*''' The intent here is genuinely `is not None`, the upload handler API [https://docs.djangoproject.com/en/6.0/ref/files/uploads/#django.core.files.uploadhandler.FileUploadHandler.file_complete documents that handlers return None to signal "not done yet"]. This case works incidentally, and would continue to work with the `__bool__` changes. Maybe that line could be if `file_obj is not None:` as a separate/additional cleanup.35 '''*''' The intent in handle_file_complete is genuinely `is not None`, the upload handler API [https://docs.djangoproject.com/en/6.0/ref/files/uploads/#django.core.files.uploadhandler.FileUploadHandler.file_complete documents that handlers return None to signal "not done yet"]. This case works incidentally, and would continue to work with the `__bool__` changes. Maybe that line could be if `file_obj is not None:` as a separate/additional cleanup.