Django

Code

Ticket #5306 (closed: fixed)

Opened 3 years ago

Last modified 1 year ago

ImageField upload_to - New Web Forms

Reported by: danielrubio Assigned to: nobody
Milestone: Component: Forms
Version: SVN Keywords: Image field upload_to, fs-rf
Cc: Triage Stage: Unreviewed
Has patch: 0 Needs documentation: 0
Needs tests: 0 Patch needs improvement: 0

Description

Just trying out the forms.ImageField? and noticed it did not allow me to pass in the parameter upload_to ( which typically goes in the model.ImageField?).

Looked over django/newforms/fields.py in SVN, and added :

  • upload_to=None as a parameter to the init function on the Field class (Line 51).

Seems to be working on the surface at least, still haven't verified the upload working though.

Attachments

Change History

09/15/07 20:45:42 changed by PhiR

  • status changed from new to closed.
  • needs_better_patch changed.
  • resolution set to duplicate.
  • needs_tests changed.
  • needs_docs changed.

will be solved by #5361.

12/11/07 12:12:00 changed by Gulopine

  • keywords changed from Image field upload_to to Image field upload_to, fs-rf.

01/21/09 06:43:10 changed by Loststylus

  • status changed from closed to reopened.
  • resolution deleted.

Still having trouble here. Django 1.0.2, forms.ImageField? doesn't accept upload_to and uploading doesn't work.

(follow-up: ↓ 5 ) 01/21/09 06:56:24 changed by mtredinnick

  • status changed from reopened to closed.
  • resolution set to fixed.

The form field wouldn't be expected to take an upload_to parameter, since forms, by default, don't save any data. That's up to either the view function or, more typically, the model. So model fields take upload_to.

Form file fields are, per se, broken, since, for example, they work in the admin. So you might wish to post some details about your situation on django-users or #django to get some help to clarify the situation. If there really is a problem here, please open a new ticket, since this ticket was about something that has already been fixed (it's not clear that it was a bug in the first place, since, again, normal forms aren't responsible for saving data).

(in reply to: ↑ 4 ) 01/21/09 09:40:56 changed by kmtracey

Replying to mtredinnick:

Form file fields are, per se, broken, ...

Just to clarify, this is missing an important 'not'. Form file fields are not, per se, broken, since they work in admin, etc.


Add/Change #5306 (ImageField upload_to - New Web Forms)




Change Properties
Action