Commit f12c9e2eda57d9bf88bda88b394d66ccaa83b179

Authored by Claude Paroz
2 parents 1cb1d181 7ab9dedc

Merge pull request #45 from collinanderson/context_instance

The context_instance argument of render_to_string is deprecated.
... ... @@ -178,9 +178,12 @@ class RenderCommentFormNode(CommentFormNode):
178 178 "comments/%s/form.html" % ctype.app_label,
179 179 "comments/form.html"
180 180 ]
181   - context.push()
182   - formstr = render_to_string(template_search_list, {"form": self.get_form(context)}, context)
183   - context.pop()
  181 + # Django 1.6 does not have context.flatten().
  182 + context_dict = {}
  183 + for d in context.dicts:
  184 + context_dict.update(d)
  185 + context_dict['form'] = self.get_form(context)
  186 + formstr = render_to_string(template_search_list, context_dict)
184 187 return formstr
185 188 else:
186 189 return ''
... ... @@ -216,11 +219,12 @@ class RenderCommentListNode(CommentListNode):
216 219 "comments/list.html"
217 220 ]
218 221 qs = self.get_queryset(context)
219   - context.push()
220   - liststr = render_to_string(template_search_list, {
221   - "comment_list": self.get_context_value_from_queryset(context, qs)
222   - }, context)
223   - context.pop()
  222 + # Django 1.6 does not have context.flatten().
  223 + context_dict = {}
  224 + for d in context.dicts:
  225 + context_dict.update(d)
  226 + context_dict['comment_list'] = self.get_context_value_from_queryset(context, qs)
  227 + liststr = render_to_string(template_search_list, context_dict)
224 228 return liststr
225 229 else:
226 230 return ''
... ...
Please register or login to post a comment