[Django] #28554: Add support for multiple file fields

77 views
Skip to first unread message

Django

unread,
Aug 31, 2017, 12:16:19 PM8/31/17
to django-...@googlegroups.com
#28554: Add support for multiple file fields
-------------------------------------+-------------------------------------
Reporter: Johannes | Owner: nobody
Hoppe |
Type: New | Status: new
feature |
Component: File | Version: 1.11
uploads/storage | Keywords: file, storage,
Severity: Normal | upload, multiple, input
Triage Stage: | Has patch: 0
Unreviewed |
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-------------------------------------+-------------------------------------
The `django.db.models.FileField` currently allows only to store a single
file URL.
This behavior seems outdated considering that `input[type=file]` supports
a `multiple` attribute, which is supported by all major Browsers.
See: https://www.w3schools.com/tags/att_input_multiple.asp

I would suggest to have a similar attribute on the database field itself,
as well as on the form field and widget.

The major point for discussion would be how to store the data. The easiest
would be to coma separate the paths in a single char field. The major
concern here would be the lack of atomicity. For databases like Postgres I
would be sensical to use the `ArrayField` as an underlying structure.
Another way for serialisation would be the use of JSONs in a char field.

All solutions based on a text or char field have an issue related to the
compatibility with the current `FileField` which is limited to 100
characters. The type would need to be migrated to a text type or the
length would need to be increased. The latter options bares the question
to which point.

Another approach would be to defer the storage issue and only provide
support for multiple files on form level.
This would mean to add a `multiple` attribute to the form field and
widget. Users would be able to create forms with multiple files in a
single field and handle storage according to their preference.

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

Django

unread,
Aug 31, 2017, 12:16:57 PM8/31/17
to django-...@googlegroups.com
#28554: Add support for multiple file fields
-------------------------------------+-------------------------------------
Reporter: Johannes Hoppe | Owner: Johannes
| Hoppe
Type: New feature | Status: assigned

Component: File | Version: 1.11
uploads/storage |
Severity: Normal | Resolution:
Keywords: file, storage, | Triage Stage:
upload, multiple, input | Unreviewed
Has patch: 0 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Johannes Hoppe):

* owner: nobody => Johannes Hoppe
* status: new => assigned


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

Django

unread,
Aug 31, 2017, 12:28:00 PM8/31/17
to django-...@googlegroups.com
#28554: Add support for multiple file fields
-------------------------------------+-------------------------------------
Reporter: Johannes Hoppe | Owner: Johannes
| Hoppe
Type: New feature | Status: assigned
Component: File | Version: 1.11
uploads/storage |
Severity: Normal | Resolution:
Keywords: file, storage, | Triage Stage:
upload, multiple, input | Unreviewed
Has patch: 0 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by Johannes Hoppe):

I tried to exclude my personal opinion and preference from the ticket
description, to have an open discussion.
So here goes my personal opinion:

It seems odd to me that the `FileField` is limited to 100 characters. I
could not find any reference to why the field was limited in the first
place. Furthermore I do not know of any file system with a 100 char
limitation nor are URLs limited to only 100 chars.

Therefore I would suggest basing the `FileField` upon the `TextField`.

I would recommend splitting the issue tho. I would first add support form
multiple files to form. This is a nice feature in itself and requires
little work and good documentation. I would presume that such a feature
would spawn a larger discussion on how to store those files. As multiple
model instances? As an Array in Postgres? As CSV or JSON in a `TextField`?
I think we can figure this out later or not at all if we don't come to a
conclusion.

I would love to work on that. I do maintain [django-
s3file](https://github.com/codingjoe/django-s3file/) and [django-
stdimage](https://github.com/codingjoe/django-stdimage/) and have some
experience with custom the `FileInput` and `FileField`. Let me know if I
can be of any help.

Cheers
-joe

--
Ticket URL: <https://code.djangoproject.com/ticket/28554#comment:2>

Django

unread,
Aug 31, 2017, 2:01:16 PM8/31/17
to django-...@googlegroups.com
#28554: Add support for multiple file fields
-------------------------------------+-------------------------------------
Reporter: Johannes Hoppe | Owner: Johannes
| Hoppe
Type: New feature | Status: assigned
Component: File | Version: master
uploads/storage |
Severity: Normal | Resolution:
Keywords: file, storage, | Triage Stage: Accepted
upload, multiple, input |
Has patch: 0 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Claude Paroz):

* version: 1.11 => master
* stage: Unreviewed => Accepted


Comment:

+1 to adding `multiple` at the form layer.

About storage, I'm not sure we'll find a common enough use case to
implement a storage strategy in Django itself. I guess that second part
warrants a discussion on django-developers.

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

Django

unread,
Sep 2, 2017, 7:18:01 AM9/2/17
to django-...@googlegroups.com
#28554: Add support for multiple file fields
-------------------------------------+-------------------------------------
Reporter: Johannes Hoppe | Owner: Johannes
| Hoppe
Type: New feature | Status: assigned
Component: File | Version: master
uploads/storage |
Severity: Normal | Resolution:
Keywords: file, storage, | Triage Stage: Accepted
upload, multiple, input |
Has patch: 1 | Needs documentation: 1
Needs tests: 1 | Patch needs improvement: 1

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Johannes Hoppe):

* needs_better_patch: 0 => 1
* has_patch: 0 => 1
* needs_tests: 0 => 1
* needs_docs: 0 => 1


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

Django

unread,
Sep 12, 2017, 11:28:06 AM9/12/17
to django-...@googlegroups.com
#28554: Add support for multiple file fields
-------------------------------------+-------------------------------------
Reporter: Johannes Hoppe | Owner: Johannes
| Hoppe
Type: New feature | Status: assigned
Component: File | Version: master
uploads/storage |
Severity: Normal | Resolution:
Keywords: file, storage, | Triage Stage: Accepted
upload, multiple, input |
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Johannes Hoppe):

* needs_better_patch: 1 => 0
* needs_tests: 1 => 0
* needs_docs: 1 => 0


--
Ticket URL: <https://code.djangoproject.com/ticket/28554#comment:5>

Django

unread,
Oct 25, 2017, 10:51:20 AM10/25/17
to django-...@googlegroups.com
#28554: Add support for multiple file fields
-------------------------------------+-------------------------------------
Reporter: Johannes Hoppe | Owner: Johannes
| Hoppe
Type: New feature | Status: assigned
Component: File | Version: master
uploads/storage |
Severity: Normal | Resolution:
Keywords: file, storage, | Triage Stage: Accepted
upload, multiple, input |
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by Thomas Güttler):

Just for the records, this lib tries to solve this:
https://github.com/Chive/django-multiupload

{{{

Django Multiupload

Build Status

Dead simple drop-in multi file upload field for django forms using HTML5's
multiple attribute.

}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/28554#comment:6>

Django

unread,
Dec 22, 2017, 7:42:50 AM12/22/17
to django-...@googlegroups.com
#28554: Add support for multiple file fields
-------------------------------------+-------------------------------------
Reporter: Johannes Hoppe | Owner: Johannes
| Hoppe
Type: New feature | Status: assigned
Component: File | Version: master
uploads/storage |
Severity: Normal | Resolution:
Keywords: file, storage, | Triage Stage: Accepted
upload, multiple, input |
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by Johannes Hoppe):

Thanks Thomas, I took a look at the package. It does a lot more than what
I want to implement here. Still it would make sense to add basic support
to Django.

--
Ticket URL: <https://code.djangoproject.com/ticket/28554#comment:7>

Django

unread,
Mar 17, 2018, 7:22:52 PM3/17/18
to django-...@googlegroups.com
#28554: Add support for multiple file fields
-------------------------------------+-------------------------------------
Reporter: Johannes Hoppe | Owner: Johannes
| Hoppe
Type: New feature | Status: assigned
Component: File | Version: master
uploads/storage |
Severity: Normal | Resolution:
Keywords: file, storage, | Triage Stage: Accepted
upload, multiple, input |
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Tim Graham):

* needs_better_patch: 0 => 1


--
Ticket URL: <https://code.djangoproject.com/ticket/28554#comment:8>

Django

unread,
Mar 24, 2018, 10:02:32 AM3/24/18
to django-...@googlegroups.com
#28554: Add support for multiple file fields
-------------------------------------+-------------------------------------
Reporter: Johannes Hoppe | Owner: Johannes
| Hoppe
Type: New feature | Status: assigned
Component: File | Version: master
uploads/storage |
Severity: Normal | Resolution:
Keywords: file, storage, | Triage Stage: Accepted
upload, multiple, input |
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Johannes Hoppe):

* needs_better_patch: 1 => 0


--
Ticket URL: <https://code.djangoproject.com/ticket/28554#comment:9>

Django

unread,
Jul 14, 2018, 3:29:16 PM7/14/18
to django-...@googlegroups.com
#28554: Add support for multiple file fields
-------------------------------------+-------------------------------------
Reporter: Johannes Hoppe | Owner: Johannes
| Hoppe
Type: New feature | Status: assigned
Component: File | Version: master
uploads/storage |
Severity: Normal | Resolution:
Keywords: file, storage, | Triage Stage: Accepted
upload, multiple, input |
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Tim Graham):

* needs_better_patch: 0 => 1


--
Ticket URL: <https://code.djangoproject.com/ticket/28554#comment:10>

Django

unread,
Dec 22, 2018, 8:10:05 AM12/22/18
to django-...@googlegroups.com
#28554: Add support for multiple file fields
-------------------------------------+-------------------------------------
Reporter: Johannes Hoppe | Owner: Johannes
| Hoppe
Type: New feature | Status: assigned
Component: File | Version: master
uploads/storage |
Severity: Normal | Resolution:
Keywords: file, storage, | Triage Stage: Accepted
upload, multiple, input |
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Johannes Hoppe):

* needs_better_patch: 1 => 0


--
Ticket URL: <https://code.djangoproject.com/ticket/28554#comment:11>

Django

unread,
Jan 9, 2019, 3:14:11 PM1/9/19
to django-...@googlegroups.com
#28554: Add support for multiple file fields
-------------------------------------+-------------------------------------
Reporter: Johannes Hoppe | Owner: Johannes
| Hoppe
Type: New feature | Status: assigned
Component: File | Version: master
uploads/storage |
Severity: Normal | Resolution:
Keywords: file, storage, | Triage Stage: Accepted
upload, multiple, input |
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Tim Graham):

* needs_better_patch: 0 => 1


--
Ticket URL: <https://code.djangoproject.com/ticket/28554#comment:12>

Django

unread,
Jan 12, 2019, 7:48:24 AM1/12/19
to django-...@googlegroups.com
#28554: Add support for multiple file fields
-------------------------------------+-------------------------------------
Reporter: Johannes Hoppe | Owner: Johannes
| Hoppe
Type: New feature | Status: assigned
Component: File | Version: master
uploads/storage |
Severity: Normal | Resolution:
Keywords: file, storage, | Triage Stage: Accepted
upload, multiple, input |
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Johannes Hoppe):

* needs_better_patch: 1 => 0


--
Ticket URL: <https://code.djangoproject.com/ticket/28554#comment:13>

Django

unread,
May 18, 2026, 8:11:52 AMMay 18
to django-...@googlegroups.com
#28554: Add support for multiple file fields
-------------------------------------+-------------------------------------
Reporter: Johannes Maron | Owner: (none)
Type: New feature | Status: new
Component: File | Version: dev
uploads/storage |
Severity: Normal | Resolution:
Keywords: file, storage, | Triage Stage: Accepted
upload, multiple, input |
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Johannes Maron):

* owner: Johannes Maron => (none)
* status: assigned => new

Django

unread,
May 18, 2026, 8:12:06 AMMay 18
to django-...@googlegroups.com
#28554: Add support for multiple file fields
-------------------------------------+-------------------------------------
Reporter: Johannes Maron | Owner: (none)
Type: New feature | Status: new
Component: File | Version: dev
uploads/storage |
Severity: Normal | Resolution:
Keywords: file, storage, | Triage Stage: Accepted
upload, multiple, input |
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Johannes Maron):

* has_patch: 1 => 0
* needs_better_patch: 1 => 0

--
Ticket URL: <https://code.djangoproject.com/ticket/28554#comment:14>
Reply all
Reply to author
Forward
0 new messages