#12229 closed (fixed)
ImageField.save should be documented upfront and obvious
Description (last modified by ) ¶
Nowhere on this page
http://docs.djangoproject.com/en/dev/ref/models/fields/
Does it say how to save an image to a filefield or imagefield. Only by digging in to the code was I able to find this:
p = Photo(...) p.image.save(filename, ContentFile(data))
which was exactly what I wanted. If there's a preferred way to do it, that'd be fine too.
Change History (10)
comment:1 by , 15 years ago
Description: | modified (diff) |
---|
comment:2 by , 15 years ago
milestone: | → 1.2 |
---|---|
Triage Stage: | Unreviewed → Accepted |
comment:3 by , 15 years ago
Has patch: | set |
---|---|
Owner: | changed from | to
Status: | new → assigned |
Added a patch that adds a large chunk to the FileField docs regarding the publicly available methods that get added by the complex machinations of FieldFile. Updates the ImageField docs as well to make it a little more obvious that it gets everything from FileField.
comment:4 by , 15 years ago
Triage Stage: | Accepted → Ready for checkin |
---|
comment:5 by , 15 years ago
Patch needs improvement: | set |
---|---|
Triage Stage: | Ready for checkin → Accepted |
The content of this patch is all good stuff, but the patch still needs work.
In particular, it is missing two things:
- A transition between the discussion about FileField, and the methods that are on FieldFile
- Corrections to the markup that suggest that open() et al are methods on FileField -- they're on FieldFile.
by , 15 years ago
Attachment: | 12229_filefield_docs_patch.diff added |
---|
Updated patch for FileField/ImageField docs that include FieldFile information
comment:6 by , 15 years ago
Patch needs improvement: | unset |
---|
Hopefully this addresses Russ' concerns above. It's a little tricky because even though the open, save, delete, etc. methods are in actuality on FieldFile, they are exposed on the FileField/ImageField instance itself. I tried to make this clear while still being technically accurate and adding a better logical separation.
comment:7 by , 15 years ago
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
(formatted description)