You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Traceback (most recent call last):
File "/Users/peterbe/dev/DJANGO/django-peterbecom/apps/homepage/tests.py", line 15, in test_render_to_string
html = render_to_string('homepage/test.html', ccontext)
File "/Users/peterbe/virtualenvs/peterbecom2/lib/python2.7/site-packages/django/template/loader.py", line 171, in render_to_string
return t.render(Context(dictionary))
File "/Users/peterbe/virtualenvs/peterbecom2/lib/python2.7/site-packages/jingo/__init__.py", line 172, in render
context_dict.update(d)
ValueError: dictionary update sequence element #0 has length 1; 2 is required
The relevant code is this:
classTemplate(jinja2.Template):
defrender(self, context={}):
"""Render's a template, context can be a Django Context or a dictionary. """# flatten the Django Context into a single dictionary.context_dict= {}
ifhasattr(context, 'dicts'):
fordincontext.dicts:
context_dict.update(d)
else:
context_dict=context
...
The text was updated successfully, but these errors were encountered:
This works in regular django:
But if fails when using jingo. It fails when the context parameter is a real subclass of the
Context
class.The documentation says you're supposed to be able to pass either a dict or a Context instance.
https://docs.djangoproject.com/en/dev/ref/templates/api/#the-render-to-string-shortcut
The traceback is this:
The relevant code is this:
The text was updated successfully, but these errors were encountered: