Opened 10 years ago

Closed 10 years ago

#24510 closed Cleanup/optimization (fixed)

FileField.upload_to documentation misleading

Reported by: Markus Bertheau Owned by: Matt Seymour
Component: Documentation Version: dev
Severity: Normal Keywords:
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: yes UI/UX: no

Description

In https://docs.djangoproject.com/en/dev/ref/models/fields/#django.db.models.FileField.upload_to it says:

A local filesystem path that will be appended to your MEDIA_ROOT setting to determine the value of the url attribute.

While this may be true with the default storage, it's misleading because it suggests that this behaviour (append to MEDIA_ROOT to get the URL) can't be changed. It's also the first sentence and main explanation for upload_to, which increases the severity of the misleading.

In particular, you might want to make uploaded files not available to the general public, i.e. use a storage with base_url set to None. The first sentence sounds like you have to hack around django to implement that.

Change History (5)

comment:1 by Markus Bertheau, 10 years ago

Also, if what's in the first sentence is really the main purpose and way of functioning for upload_to, then upload_to is a misnomer.

comment:2 by Tim Graham, 10 years ago

Triage Stage: UnreviewedAccepted

If you'd like to draft a patch, I'll be happy to review it.

comment:3 by Matt Seymour, 10 years ago

Owner: changed from nobody to Matt Seymour
Status: newassigned

comment:4 by Matt Seymour, 10 years ago

Easy pickings: set
Has patch: set

Pull request added at github https://github.com/django/django/pull/4396

comment:5 by Tim Graham <timograham@…>, 10 years ago

Resolution: fixed
Status: assignedclosed

In 98c5370:

Fixed #24510 -- Clarified FileField.upload_to docs.

Note: See TracTickets for help on using tickets.
Back to Top