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:
217
217
218
218
.. code-block :: python
219
219
220
- from django.shortcuts import render_to_response
220
+ from django.shortcuts import render
221
221
from django.http import HttpResponseBadRequest
222
222
from django import forms
223
- from django.template import RequestContext
224
223
import django_excel as excel
225
224
226
225
class UploadFileForm (forms .Form ):
@@ -236,14 +235,20 @@ Here is the example viewing function codes:
236
235
return HttpResponseBadRequest()
237
236
else :
238
237
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})
242
239
243
240
def download (request ):
244
241
sheet = excel.pe.Sheet([[1 , 2 ],[3 , 4 ]])
245
242
return excel.make_response(sheet, " csv" )
246
243
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
+
247
252
Development guide
248
253
================================================================================
249
254
You can’t perform that action at this time.
0 commit comments