Changes between Initial Version and Version 2 of Ticket #26367


Ignore:
Timestamp:
03/17/2016 09:42:26 AM (3 years ago)
Author:
Tim Graham
Comment:

The _size removal looks okay to me: PR

Not sure about whether this solves the issue of not requiring Django's File subclass, but accepting for further investigation.

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #26367

    • Property Triage Stage changed from Unreviewed to Accepted
    • Property Summary changed from Minor FieldFile (proxy for FieldFile) improvement? to Assess if FieldFile can work with stdlib File instead of requiring Django's File
  • Ticket #26367 – Description

    initial v2  
    11The FileField docs (https://docs.djangoproject.com/es/1.9/ref/models/fields/#django.db.models.FileField) state that in order to save a file into a FileField (through FieldFile proxy) you need a django File object and not a regular one.
    22
    3 Looking at the code (https://github.com/django/django/blob/master/django/db/models/fields/files.py#L92 ) it seems like the only reason to have a File object is because it needs the 'size' property which isn't available on every file-like object.
     3Looking at the code (https://github.com/django/django/blob/28bcff82c5ed4694f4761c303294ffafbd7096ce/django/db/models/fields/files.py#L92 ) it seems like the only reason to have a File object is because it needs the 'size' property which isn't available on every file-like object.
    44Looking into the same file, it doesn't seem anyone uses _size anymore, only its parent class, BUT, this class actually overrides the size property so it is not calling the parent class .size (and if it did, it would cache it).
    55
Back to Top