#18840 closed Cleanup/optimization (fixed)
Important upload_to parameter is missing from upload doc
Reported by: | Vlada Macek | Owned by: | nobody |
---|---|---|---|
Component: | Documentation | Version: | 1.4 |
Severity: | Normal | Keywords: | |
Cc: | Triage Stage: | Accepted | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
The file uploads topic and even ref page don't mention the upload_to
parameter that is required:
- https://docs.djangoproject.com/en/dev/topics/http/file-uploads/
- https://docs.djangoproject.com/en/dev/ref/forms/fields/
If the newbie follows the top example on the topic page:
class UploadFileForm(forms.Form): title = forms.CharField(max_length=50) file = forms.FileField()
he or she is immediatelly confused by the model validation error.
Change History (4)
comment:1 by , 12 years ago
Triage Stage: | Unreviewed → Accepted |
---|---|
Type: | Bug → Cleanup/optimization |
comment:2 by , 12 years ago
Of course, I confused the forms vs. models FieldField
myself. :) Sorry for the noise.
Version 0, edited 12 years ago by (next)
comment:3 by , 12 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
Note:
See TracTickets
for help on using tickets.
It would be out-of-place and confusing to say anything about
upload_to
near where the quoted snippet appears in the documentation, because that snippet concerns a plain form, not a model form, and puttingupload_to
on theforms.FileField
would be an error.upload_to
is a required parameter ofmodels.FileField
, and its documentation clearly notes that (https://docs.djangoproject.com/en/dev/ref/models/fields/#django.db.models.FileField). Whereupload_to
could be mentioned in the referenced doc is: https://docs.djangoproject.com/en/dev/topics/http/file-uploads/#handling-uploaded-files-with-a-model. Something could be added in those first two sentences noting that themodels.FileField
upload_to
parameter controls where the file will be saved.I don't think it would be appropriate to add any mention of
upload_to
to the forms field reference, as it is not a parameter of the forms-levelFileField
.