Changeset 6288
- Timestamp:
- 09/15/07 10:17:18 (1 year ago)
- Files:
-
- django/trunk/docs/newforms.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
django/trunk/docs/newforms.txt
r6273 r6288 780 780 ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 781 781 782 If you're writing some reusable views or templates, you may not know ahead of783 time whether your form is a multipart form or not. The ``is_multipart()`` 784 method tells you ifthe form requires multipart encoding for submission::782 If you're writing reusable views or templates, you may not know ahead of time 783 whether your form is a multipart form or not. The ``is_multipart()`` method 784 tells you whether the form requires multipart encoding for submission:: 785 785 786 786 >>> f = ContactFormWithMugshot() … … 788 788 True 789 789 790 In a template, this sort of code could be useful::790 Here's an example of how you might use this in a template:: 791 791 792 792 {% if form.is_multipart %} 793 <form enctype="multipart/form-data" method="post" action="/foo/">793 <form enctype="multipart/form-data" method="post" action="/foo/"> 794 794 {% else %} 795 <form method="post" action="/foo/">795 <form method="post" action="/foo/"> 796 796 {% endif %} 797 797 {% form %}
