Hi Joe,
Just an idea:
Why not just use another keyword argument, like "files_number", "count",
"max_files" (along maybe with a "min_files"), or something like, with a
default of 1 (to match current behaviour with a single file), and an
allowed value of 0 for infinite?
If you allow multiple files upload at once, chances are that there will
be many use cases for limiting the number of uploads to a specific
range/value.
Not sure about the form's implementation, though.
- Brice
Le 25/08/2018 à 21:05, Johannes Hoppe a écrit :
Hi there!
I do need some feedback on the best public API to implement multi file
support to Django forms.
Context:
Up until now Django forms do not support multi file upload. You will
need to write your own view to handle the files as described here:
https://docs.djangoproject.com/en/2.1/topics/http/file-uploads/#uploading-multiple-files
Of course it is not too hard to implement actual multi file support as
I have been showcasing here:
https://github.com/django/django/pull/9011/files
The question is now to best add support for multiple file uploads
without wrecking backwards compatibility?
As Tim wisely mentioned, it might be confusing to add a `multiple`
argument to the FileField while also having the
|
attrs={'multiple':True}
|
still in the mix.
My suggestion would be to add the new keyword argument which enable
the new behavior and keep the attr-thing as is.
I could add a warning if someone uses the "old" style. It is a bit
suggestive though.
What do you think, mabe look at the documentation changes in the PR
for more context.
Best
-Joe
--
You received this message because you are subscribed to the Google
Groups "Django developers (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send
an email to django-developers+unsubscr...@googlegroups.com
<mailto:django-developers+unsubscr...@googlegroups.com>.
To post to this group, send email to
django-developers@googlegroups.com
<mailto:django-developers@googlegroups.com>.
Visit this group at https://groups.google.com/group/django-developers.
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-developers/e71675d3-be96-4189-b0c1-038774626284%40googlegroups.com
<https://groups.google.com/d/msgid/django-developers/e71675d3-be96-4189-b0c1-038774626284%40googlegroups.com?utm_medium=email&utm_source=footer>.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "Django
developers (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to django-developers+unsubscr...@googlegroups.com.
To post to this group, send email to django-developers@googlegroups.com.
Visit this group at https://groups.google.com/group/django-developers.
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-developers/73de1c91-dc5c-9b72-10fc-af37e36c50a2%40brice.xyz.
For more options, visit https://groups.google.com/d/optout.