From 262645d5b5e700d022595006b1fee6a76505578f Mon Sep 17 00:00:00 2001 From: Oon Arfiandwi Date: Sat, 29 Jul 2017 13:10:00 +0700 Subject: [PATCH] Update README.rst The context_instance parameter in render_to_response was deprecated in Django 1.8, and removed in Django 1.10. So I propose to use render instead. And I also add simple form snippet to complete the code. --- README.rst | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/README.rst b/README.rst index 03db657..d7db1a3 100644 --- a/README.rst +++ b/README.rst @@ -217,10 +217,9 @@ Here is the example viewing function codes: .. code-block:: python - from django.shortcuts import render_to_response + from django.shortcuts import render from django.http import HttpResponseBadRequest from django import forms - from django.template import RequestContext import django_excel as excel class UploadFileForm(forms.Form): @@ -236,14 +235,20 @@ Here is the example viewing function codes: return HttpResponseBadRequest() else: form = UploadFileForm() - return render_to_response('upload_form.html', - {'form': form}, - context_instance=RequestContext(request)) + return render(request, 'upload_form.html', {'form': form}) def download(request): sheet = excel.pe.Sheet([[1, 2],[3, 4]]) return excel.make_response(sheet, "csv") +.. code-block:: html + +
+ {% csrf_token %} + {{ form }} + +
+ Development guide ================================================================================