summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHasan Ramezani <hasan.r67@gmail.com>2019-10-25 08:11:11 +0200
committerMariusz Felisiak <felisiak.mariusz@gmail.com>2019-10-25 08:12:40 +0200
commit9d627bf9b222758d8cccaecce53115cdd5bc1fa0 (patch)
treed96e26305a0fc13ef11f0e9c880fe758c4125fd9
parent7fe09e6d41b35d5a9a03783650249723313d3793 (diff)
downloaddjango-9d627bf9b222758d8cccaecce53115cdd5bc1fa0.tar.gz
[2.2.x] Fixed #30906 -- Fixed an example of using the template system to generate CSV.
Backport of 05c3ef26a203de1bc227e31b88999ff2e3b11abf from master
-rw-r--r--docs/howto/outputting-csv.txt6
1 files changed, 2 insertions, 4 deletions
diff --git a/docs/howto/outputting-csv.txt b/docs/howto/outputting-csv.txt
index 4d614b6ab8..c29e9bc2a6 100644
--- a/docs/howto/outputting-csv.txt
+++ b/docs/howto/outputting-csv.txt
@@ -105,7 +105,7 @@ template output the commas in a :ttag:`for` loop.
Here's an example, which generates the same CSV file as above::
from django.http import HttpResponse
- from django.template import Context, loader
+ from django.template import loader
def some_view(request):
# Create the HttpResponse object with the appropriate CSV header.
@@ -120,9 +120,7 @@ Here's an example, which generates the same CSV file as above::
)
t = loader.get_template('my_template_name.txt')
- c = Context({
- 'data': csv_data,
- })
+ c = {'data': csv_data}
response.write(t.render(c))
return response