Opened 16 years ago
Closed 16 years ago
#10044 closed (fixed)
FileField should accept assignment of File objects
Reported by: | Marty Alchin | Owned by: | Marty Alchin |
---|---|---|---|
Component: | File uploads/storage | Version: | 1.0 |
Severity: | Keywords: | ||
Cc: | Triage Stage: | Unreviewed | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | yes |
Easy pickings: | no | UI/UX: | no |
Description
Currently, FileField
attributes can only receive new File
content by way of the save()
method, which commits the file to storage immediately. In order to support model validation, and perhaps elsewhere, these attributes should be able to accept a File
object directly and delay saving them to storage until the model instance is saved.
Attachments (2)
Change History (5)
by , 16 years ago
Attachment: | 10044.diff added |
---|
by , 16 years ago
Attachment: | 10044.2.diff added |
---|
Removed the save_form_data() override in FileField, now that the standard behavior is sufficient for populating a model from a form (and delaying the save is better typically, anyway)
comment:1 by , 16 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
comment:2 by , 16 years ago
Patch needs improvement: | set |
---|---|
Resolution: | fixed |
Status: | closed → reopened |
The patch breaks the behavior of the width_field and height_field properties of ImageField when using the admin.
See this thread for details: http://groups.google.com/group/django-users/browse_thread/thread/6fb4b1e8ec37fda3/eaf739b883e66fcf#eaf739b883e66fcf
comment:3 by , 16 years ago
Resolution: | → fixed |
---|---|
Status: | reopened → closed |
This bug has been fixed, please open a new ticket since thats a seperate issue(even if it's a consequence of this)(I think a ticket is already open).
Updated FieldFile to accept File objects through attribute assignment, saving them automatically when the associated instance is saved