summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBerker Peksag <berker.peksag@gmail.com>2016-06-04 06:24:30 -0700
committerTim Graham <timograham@gmail.com>2016-06-04 09:24:50 -0400
commit9e5b544713d9f030eaf33487328cf4d49e88cfa4 (patch)
tree39f38c8f033a381c203b3c1ce96bb5b2445067ff
parent8996054cb4b3cfb88ee4d8896fa53424440a2564 (diff)
[1.10.x] Used snippet directive in file upload example.
Backport of b9c04801d4b9ad37bd062cbca1a521eaf4047aa8 from master
-rw-r--r--docs/topics/http/file-uploads.txt11
1 files changed, 8 insertions, 3 deletions
diff --git a/docs/topics/http/file-uploads.txt b/docs/topics/http/file-uploads.txt
index 4b13b292ba..8a7191ac1d 100644
--- a/docs/topics/http/file-uploads.txt
+++ b/docs/topics/http/file-uploads.txt
@@ -19,9 +19,11 @@ and in memory, and how to customize the default behavior.
Basic file uploads
==================
-Consider a simple form containing a :class:`~django.forms.FileField`::
+Consider a simple form containing a :class:`~django.forms.FileField`:
+
+.. snippet::
+ :filename: forms.py
- # In forms.py...
from django import forms
class UploadFileForm(forms.Form):
@@ -42,7 +44,10 @@ the request has the attribute ``enctype="multipart/form-data"``. Otherwise,
Most of the time, you'll simply pass the file data from ``request`` into the
form as described in :ref:`binding-uploaded-files`. This would look
-something like::
+something like:
+
+.. snippet::
+ :filename: views.py
from django.http import HttpResponseRedirect
from django.shortcuts import render