Opened 9 years ago

Closed 9 years ago

#24785 closed Bug (needsinfo)

render_to_string makes invalid call to template.render

Reported by: Dan Poirier Owned by: nobody
Component: Template system Version: 1.8
Severity: Normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no


Line 92 in django/template/, here:

    return template.render(context, request)

calls template.render with two arguments.

But template.render here:

    def render(self, context):

only takes one argument. Here's the resulting error:

  File ".../lib/python3.4/site-packages/django/template/", line 99, in render_to_string
    return template.render(context, request)
TypeError: render() takes 2 positional arguments but 3 were given

Change History (1)

comment:1 Changed 9 years ago by Aymeric Augustin

Resolution: needsinfo
Status: newclosed

In the first piece of code you're quoting, template is expected to be a backend-dependent Template wrapper as specified in DEP 182, for example django.template.backends.django.Template.

The second piece of code refers to django.template.base.Template. I don't have enough information about your project to say why you're getting the wrong type of template there.

Can you check the 1.8 release notes and upgrade instructions to make sure you updated your code appropriately?

Note: See TracTickets for help on using tickets.
Back to Top