Opened 11 years ago

Closed 11 years ago

Last modified 11 years ago

#19610 closed Cleanup/optimization (fixed)

Include enctype in example forms

Reported by: will@… Owned by: nobody
Component: Documentation Version: 1.4
Severity: Normal Keywords:
Cc: Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: yes UI/UX: no

Description

On this page:
https://docs.djangoproject.com/en/dev/topics/forms/

It took me ages to figure out the reason files weren't uploading was because I'd left out enctype="multipart/form-data" from my <form> tag in my template.
I suggest changing the template examples from:

<form action="/contact/" method="post">{% csrf_token %}
{{ form.as_p }}
<input type="submit" value="Submit" />
</form>

to:

<form action="/contact/" method="post" enctype="multipart/form-data">{% csrf_token %}
{{ form.as_p }}
<input type="submit" value="Submit" />
</form>

Attachments (1)

19610.diff (1.4 KB ) - added by Tim Graham 11 years ago.

Download all attachments as: .zip

Change History (8)

comment:1 by Simon Charette, 11 years ago

What about using the is_multipart property in the documentation?

<form action="/contact/" method="post"{% if form.is_multipart %} enctype="multipart/form-data"{% endif %}>{% csrf_token %}
{{ form.as_p }}
<input type="submit" value="Submit" />
</form>

comment:2 by Tim Graham, 11 years ago

Easy pickings: set
Triage Stage: UnreviewedAccepted
Type: UncategorizedCleanup/optimization

+1

by Tim Graham, 11 years ago

Attachment: 19610.diff added

comment:3 by Tim Graham, 11 years ago

Has patch: set

comment:4 by Claude Paroz, 11 years ago

Triage Stage: AcceptedReady for checkin

comment:5 by Tim Graham <timograham@…>, 11 years ago

Resolution: fixed
Status: newclosed

In 0de2645c00c2330060c9889c71afd3a528ed7a3a:

Fixed #19610 - Added enctype note to forms topics doc.

Thanks will@ for the suggestion.

comment:6 by Tim Graham <timograham@…>, 11 years ago

In 2e6b0c5ca7265b3cee2ff68a9ef5d1865afb9a49:

[1.5.x] Fixed #19610 - Added enctype note to forms topics doc.

Thanks will@ for the suggestion.

Backport of 0de2645c00 from master

comment:7 by Tim Graham <timograham@…>, 11 years ago

In 2e6b0c5ca7265b3cee2ff68a9ef5d1865afb9a49:

[1.5.x] Fixed #19610 - Added enctype note to forms topics doc.

Thanks will@ for the suggestion.

Backport of 0de2645c00 from master

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