Opened 4 years ago

Closed 4 years ago

#32098 closed Cleanup/optimization (fixed)

Made FieldFile use FileField.attname

Reported by: Sultan Owned by: Sultan
Component: Database layer (models, ORM) Version: dev
Severity: Normal Keywords:
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description (last modified by Sultan)

In ticket #31701, I suggested making FileDescriptor a subclass of DeferredAttribute and using FileField.attname to access the field data, leaving FileField.name so that users can freely and easily create their own custom subclasses that can not only save data to files, but also represent the same data with a different data type by attaching FileFiled.name to a particular descriptor (just as it is implemented in the models.ForeignKey).

In the patch attached to ticket #31701, I fixed FileField, ImageField and their descriptors, but missed the FieldFile, which still uses FileField.name when saving/deleting a file. I checked everything and made the necessary changes (2 lines).

Change History (4)

comment:1 by Sultan, 4 years ago

Owner: changed from nobody to Sultan
Status: newassigned

comment:2 by Sultan, 4 years ago

Description: modified (diff)

comment:3 by Mariusz Felisiak, 4 years ago

Triage Stage: UnreviewedAccepted

comment:4 by GitHub <noreply@…>, 4 years ago

Resolution: fixed
Status: assignedclosed

In 6599608c:

Fixed #32098 -- Made FieldFile use FileField.attname.

After a93425a37f4defdb31d4ca96bb3bf6da21f0b5ce FileDescriptor is a
subclass of DeferredAttribute and uses FileField.attname to access the
field data, so that custom subclasses can not only save data to files,
but also represent the same data with a different data type by
attaching FileFiled.name to a particular descriptor.

Follow up to a93425a37f4defdb31d4ca96bb3bf6da21f0b5ce.

Note: See TracTickets for help on using tickets.
Back to Top