﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
30906	Error Outputting CSV code example. Template.render() does not accept Context objects.	Philipp Maino	Hasan Ramezani	"https://docs.djangoproject.com/en/3.0/howto/outputting-csv/

We can find in the section ""Using the template system"" in the docs about ""Outputing csv with django"" the following code:
{{{#!python
t = loader.get_template('my_template_name.txt')
c = Context({
      'data': csv_data,
})
response.write(t.render(c))
}}}

The django.template.loader.render is expecting a dict though and not a Context object as we can see here:

{{{#!python
class Template:

    def __init__(self, template, backend):
        self.template = template
        self.backend = backend

    @property
    def origin(self):
        return self.template.origin

    def render(self, context=None, request=None):
        context = make_context(context, request, autoescape=self.backend.engine.autoescape)
     .
     .
     .


def make_context(context, request=None, **kwargs):
""""""
Create a suitable Context from a plain dict and optionally an HttpRequest.
""""""
if context is not None and not isinstance(context, dict):
    raise TypeError('context must be a dict rather than %s.' % context.__class__.__name__)
}}}"	Cleanup/optimization	closed	Documentation	2.2	Normal	fixed	Context, template, loader, render		Accepted	1	0	0	0	1	0
