Re: [Django] #32098: Made FieldFile use FileField.attname

13 views
Skip to first unread message

Django

unread,
Oct 10, 2020, 5:22:47 AM10/10/20
to django-...@googlegroups.com
#32098: Made FieldFile use FileField.attname
-------------------------------------+-------------------------------------
Reporter: Sultan | Owner: Sultan
Type: | Status: assigned
Cleanup/optimization |
Component: Database layer | Version: master
(models, ORM) |
Severity: Normal | Resolution:
Keywords: | Triage Stage:
| Unreviewed
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Description changed by Sultan:

Old 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).

New description:

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).

--

--
Ticket URL: <https://code.djangoproject.com/ticket/32098#comment:2>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Oct 12, 2020, 12:51:49 AM10/12/20
to django-...@googlegroups.com
#32098: Made FieldFile use FileField.attname
-------------------------------------+-------------------------------------
Reporter: Sultan | Owner: Sultan
Type: | Status: assigned
Cleanup/optimization |
Component: Database layer | Version: master
(models, ORM) |
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted

Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by felixxm):

* stage: Unreviewed => Accepted


--
Ticket URL: <https://code.djangoproject.com/ticket/32098#comment:3>

Django

unread,
Oct 12, 2020, 1:23:35 AM10/12/20
to django-...@googlegroups.com
#32098: Made FieldFile use FileField.attname
-------------------------------------+-------------------------------------
Reporter: Sultan | Owner: Sultan
Type: | Status: closed

Cleanup/optimization |
Component: Database layer | Version: master
(models, ORM) |
Severity: Normal | Resolution: fixed

Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by GitHub <noreply@…>):

* status: assigned => closed
* resolution: => fixed


Comment:

In [changeset:"6599608c4d0befdcb820ddccce55f183f247ae4f" 6599608c]:
{{{
#!CommitTicketReference repository=""
revision="6599608c4d0befdcb820ddccce55f183f247ae4f"
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.
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/32098#comment:4>

Reply all
Reply to author
Forward
0 new messages