Opened 5 years ago

Closed 5 years ago

#14416 closed (worksforme)

ImageField forms require an enctype, not documented

Reported by: airstrike Owned by: nobody
Component: Documentation Version:
Severity: Keywords: ImageField enctype form HTML
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

Well, this may very well not be a Django issue, but I can't help but suggest that this small caveat be documented somewhere.

Forms with ImageField require an enctype attribute such as <form enctype="multipart/form-data" method="post" action="">. Yes, it's HTML, not Django. But frustrating nonetheless.

As you can see by reactions in http://stackoverflow.com/questions/680770/django-imagefield-not-working-properly-via-modelform many new developers have a tough time when dealing with this issue. I'm not bold enough to submit a documentation patch, but it should be fairly simple to explain.

Change History (2)

comment:1 Changed 5 years ago by lrekucki

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset

This is documented: http://docs.djangoproject.com/en/dev/ref/forms/api/#binding-uploaded-files. Description of both FileField and ImageField link to that page. There is also a link in "Working with forms" article.

comment:2 Changed 5 years ago by gremmie

  • Resolution set to worksforme
  • Status changed from new to closed
Note: See TracTickets for help on using tickets.
Back to Top