Changes between Initial Version and Version 1 of Ticket #27150, comment 11


Ignore:
Timestamp:
Mar 24, 2026, 7:33:23 AM (2 weeks ago)
Author:
blighj

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #27150, comment 11

    initial v1  
    88|| [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 ||
    99|| [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 ||
    1111|| [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 ||
    1212|| [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 ||
     
    3030The 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.
    3131
    32 I think we should close and pause the current PR and instead move this ticket back to unreviewed, so a member of the triage team can have a think about it.
     32I 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.
    3333
    3434----
    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.
Back to Top