[Answer]-Render_to_string() got multiple values for argument 'context_instance'

1👍

Here is the render_to_string from the django source django.template.engine :

def render_to_string(self, template_name, dictionary=None, context_instance=None,
                         dirs=_dirs_undefined):

It gets called with (*args,**kwargs) passed from render_to_response() It is clear that your context argument conflicts with keyword argument assigned by you which is context_instance. You should only send one of those. Maybe you should put the data from context inside your args dictionary?

By the way you can look at the docs here:
https://docs.djangoproject.com/en/dev/ref/templates/api/#the-render-to-string-shortcut
and here:
https://docs.djangoproject.com/en/dev/topics/http/shortcuts/#render-to-response

to see the list of arguments each of this functions accepts.

Leave a comment