#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 , 13 years ago
| Triage Stage: | Unreviewed → Accepted |
|---|---|
| Type: | Bug → Cleanup/optimization |
comment:2 by , 13 years ago
Of course, I confused the forms vs. models FieldField myself. :) Sorry for the noise.
Version 0, edited 13 years ago by (next)
comment:3 by , 13 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_tonear where the quoted snippet appears in the documentation, because that snippet concerns a plain form, not a model form, and puttingupload_toon theforms.FileFieldwould be an error.upload_tois 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_tocould 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.FileFieldupload_toparameter controls where the file will be saved.I don't think it would be appropriate to add any mention of
upload_toto the forms field reference, as it is not a parameter of the forms-levelFileField.