Opened 14 years ago

Closed 14 years ago

Last modified 12 years ago

#12229 closed (fixed)

ImageField.save should be documented upfront and obvious

Reported by: freyley Owned by: Gabriel Hurley
Component: Documentation Version: 1.1
Severity: Keywords:
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description (last modified by Ramiro Morales)

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.

Attachments (1)

12229_filefield_docs_patch.diff (3.9 KB ) - added by Gabriel Hurley 14 years ago.
Updated patch for FileField/ImageField docs that include FieldFile information

Download all attachments as: .zip

Change History (10)

comment:1 by Ramiro Morales, 14 years ago

Description: modified (diff)

(formatted description)

comment:2 by Russell Keith-Magee, 14 years ago

milestone: 1.2
Triage Stage: UnreviewedAccepted

comment:3 by Gabriel Hurley, 14 years ago

Has patch: set
Owner: changed from nobody to Gabriel Hurley
Status: newassigned

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 Russell Keith-Magee, 14 years ago

Triage Stage: AcceptedReady for checkin

comment:5 by Russell Keith-Magee, 14 years ago

Patch needs improvement: set
Triage Stage: Ready for checkinAccepted

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 Gabriel Hurley, 14 years ago

Updated patch for FileField/ImageField docs that include FieldFile information

comment:6 by Gabriel Hurley, 14 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 Russell Keith-Magee, 14 years ago

Resolution: fixed
Status: assignedclosed

(In [13202]) Fixed #12229 -- Added documentation of the FieldFile methods that are exposed by FileField and ImageField. Thanks to Gabriel Hurley for the draft patch.

comment:8 by Russell Keith-Magee, 14 years ago

(In [13203]) [1.1.X] Fixed #12229 -- Added documentation of the FieldFile methods that are exposed by FileField and ImageField. Thanks to Gabriel Hurley for the draft patch.

Backport of r13202 from trunk.

comment:9 by Jacob, 12 years ago

milestone: 1.2

Milestone 1.2 deleted

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