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 @@ -219,10 +219,9 @@ Here is the example viewing function codes:
219219
220220.. code-block :: python
221221
222- from django.shortcuts import render_to_response
222+ from django.shortcuts import render
223223 from django.http import HttpResponseBadRequest
224224 from django import forms
225- from django.template import RequestContext
226225 import django_excel as excel
227226
228227 class UploadFileForm (forms .Form ):
@@ -238,14 +237,20 @@ Here is the example viewing function codes:
238237 return HttpResponseBadRequest()
239238 else :
240239 form = UploadFileForm()
241- return render_to_response(' upload_form.html' ,
242- {' form' : form},
243- context_instance = RequestContext(request))
240+ return render(request, ' upload_form.html' , {' form' : form})
244241
245242 def download (request ):
246243 sheet = excel.pe.Sheet([[1 , 2 ],[3 , 4 ]])
247244 return excel.make_response(sheet, " csv" )
248245
246+ .. code-block :: html
247+
248+ <form action =" /upload-file/" enctype =" multipart/form-data" method =" post" >
249+ {% csrf_token %}
250+ {{ form }}
251+ <input type =" submit" value =" Submit" />
252+ </form >
253+
249254Development guide
250255================================================================================
251256
You can’t perform that action at this time.
0 commit comments