[Django] #31684: Document upload_to method behavior when duplicate file is present

6 views
Skip to first unread message

Django

unread,
Jun 10, 2020, 2:37:28 PM6/10/20
to django-...@googlegroups.com
#31684: Document upload_to method behavior when duplicate file is present
-------------------------------------+-------------------------------------
Reporter: Matthew | Owner: nobody
Pava |
Type: | Status: new
Cleanup/optimization |
Component: | Version: master
Documentation |
Severity: Normal | Keywords: FileField upload_to
Triage Stage: | Has patch: 0
Unreviewed |
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 1
UI/UX: 0 |
-------------------------------------+-------------------------------------
I have a FileField with a custom upload_to method that generates a
completely new path and filename. In my unit tests, I discovered that the
default behavior of adding random characters to the end of the file name
was enabled when the file name already existed. It took me a week to
figure this out. Documenting this fact would have been incredibly helpful.

https://docs.djangoproject.com/en/3.0/ref/models/fields/#django.db.models.FileField.upload_to

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

Django

unread,
Jun 10, 2020, 2:41:12 PM6/10/20
to django-...@googlegroups.com
#31684: Document upload_to method behavior when duplicate file is present
-------------------------------------+-------------------------------------
Reporter: Matthew Pava | Owner: nobody
Type: | Status: new
Cleanup/optimization |
Component: Documentation | Version: master
Severity: Normal | Resolution:

Keywords: FileField upload_to | Triage Stage:
| Unreviewed
Has patch: 0 | Needs documentation: 0

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

Comment (by Matthew Pava):

So I just discovered that this detail is documented in Storage.save(),
which is mentioned in the documentation for that method. So maybe this
isn't completely necessary, but it still feels like this documentation
could be improved here somewhat. But I also understand if we just mark
this as invalid.

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

Reply all
Reply to author
Forward
0 new messages