Opened 8 years ago

Closed 6 years ago

Last modified 6 years ago

#5306 closed (fixed)

ImageField upload_to - New Web Forms

Reported by: danielrubio Owned by: nobody
Component: Forms Version: master
Severity: Keywords: Image field upload_to, fs-rf
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

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.

Change History (5)

comment:1 Changed 8 years ago by PhiR

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Resolution set to duplicate
  • Status changed from new to closed

will be solved by #5361.

comment:2 Changed 7 years ago by Gulopine

  • Keywords fs-rf added

comment:3 Changed 6 years ago by Loststylus

  • Resolution duplicate deleted
  • Status changed from closed to reopened

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

comment:4 follow-up: Changed 6 years ago by mtredinnick

  • Resolution set to fixed
  • Status changed from reopened to closed

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).

comment:5 in reply to: ↑ 4 Changed 6 years ago 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.

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