File tree Expand file tree Collapse file tree 1 file changed +10
-5
lines changed
Expand file tree Collapse file tree 1 file changed +10
-5
lines changed Original file line number Diff line number Diff line change @@ -217,10 +217,9 @@ Here is the example viewing function codes:
217217
218218.. code-block :: python
219219
220- from django.shortcuts import render_to_response
220+ from django.shortcuts import render
221221 from django.http import HttpResponseBadRequest
222222 from django import forms
223- from django.template import RequestContext
224223 import django_excel as excel
225224
226225 class UploadFileForm (forms .Form ):
@@ -236,14 +235,20 @@ Here is the example viewing function codes:
236235 return HttpResponseBadRequest()
237236 else :
238237 form = UploadFileForm()
239- return render_to_response(' upload_form.html' ,
240- {' form' : form},
241- context_instance = RequestContext(request))
238+ return render(request, ' upload_form.html' , {' form' : form})
242239
243240 def download (request ):
244241 sheet = excel.pe.Sheet([[1 , 2 ],[3 , 4 ]])
245242 return excel.make_response(sheet, " csv" )
246243
244+ .. code-block :: html
245+
246+ <form action =" /upload-file/" enctype =" multipart/form-data" method =" post" >
247+ {% csrf_token %}
248+ {{ form }}
249+ <input type =" submit" value =" Submit" />
250+ </form >
251+
247252Development guide
248253================================================================================
249254
You can’t perform that action at this time.
0 commit comments