[Django] #30777: File isn't treated correctly, when in user-defined field

7 views
Skip to first unread message

Django

unread,
Sep 17, 2019, 3:47:43 AM9/17/19
to django-...@googlegroups.com
#30777: File isn't treated correctly, when in user-defined field
-------------------------------------+-------------------------------------
Reporter: Simonas0 | Owner: nobody
Type: Bug | Status: new
Component: File | Version: master
uploads/storage | Keywords: custom field,
Severity: Normal | composite field, user-defined
Triage Stage: | field, file
Unreviewed | Has patch: 0
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-------------------------------------+-------------------------------------
When `models.FileField` is in `models.Model`, everything works as
expected.
When `models.FileField` is in `models.Field` which is in `models.Model`,
when saving, `ProgrammingError` `can't adapt type 'TemporaryUploadedFile'`
is raised.
That happens, because `FileField.save_form_data()` makes `FileField` to
hold `FieldFile`, but `models.Field` makes its `FileField` to hold
`TemporaryUploadedFile`.
I've prepared repo with minimal setup to reproduce bug:
https://github.com/Simonas0/django_playground

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

Django

unread,
Sep 17, 2019, 7:36:11 AM9/17/19
to django-...@googlegroups.com
#30777: File isn't treated correctly, when in user-defined field.

-------------------------------------+-------------------------------------
Reporter: Simonas0 | Owner: nobody
Type: Bug | Status: closed

Component: File | Version: master
uploads/storage |
Severity: Normal | Resolution: invalid
Keywords: custom field, | Triage Stage:
composite field, user-defined | Unreviewed
field, file |

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

* status: new => closed
* resolution: => invalid


Comment:

Trac is not a good place to ask for help. You described an issue with your
custom field implementation rather then an issue in Django. Please check
[https://docs.djangoproject.com/en/2.2/howto/custom-model-
fields/#writing-a-filefield-subclass documentation] and use one of
[https://code.djangoproject.com/wiki/TicketClosingReasons/UseSupportChannels
support channels].


Closing per TicketClosingReasons/UseSupportChannels.

--
Ticket URL: <https://code.djangoproject.com/ticket/30777#comment:1>

Reply all
Reply to author
Forward
0 new messages