Opened 5 years ago
Last modified 5 years ago
#32098 closed Cleanup/optimization
Made FieldFile use FileField.attname — at Initial Version
| Reported by: | Sultan | Owned by: | nobody | 
|---|---|---|---|
| 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
In ticket #31701, I suggested making FileDescriptor a subclass of DeferredAttribute and using FileField.attname to access the field data, leaving FileField.name for users to freely and easily create their own subclasses (e.g. ContentFileField, JSONContentFileField, etc.) ), to represent data in a different format; JSONContentFileField.attname represents File object (field data) and JSONContentFileField.name represents deserialized JSON document to Python object (client data).
In the patch attached to ticket #31701, I fixed FileField, ImageField and their descriptors, but missed the FieldFile, which uses FileField.name when saving / deleting a file. I checked everything and made the necessary changes (2 lines).