Commit 7ab9dedc4df00c497624b0512e659a2ba4e65132
1 parent
1cb1d181
The context_instance argument of render_to_string is deprecated.
Showing
1 changed file
with
12 additions
and
8 deletions
| @@ -178,9 +178,12 @@ class RenderCommentFormNode(CommentFormNode): | @@ -178,9 +178,12 @@ class RenderCommentFormNode(CommentFormNode): | ||
| 178 | "comments/%s/form.html" % ctype.app_label, | 178 | "comments/%s/form.html" % ctype.app_label, |
| 179 | "comments/form.html" | 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 | return formstr | 187 | return formstr |
| 185 | else: | 188 | else: |
| 186 | return '' | 189 | return '' |
| @@ -216,11 +219,12 @@ class RenderCommentListNode(CommentListNode): | @@ -216,11 +219,12 @@ class RenderCommentListNode(CommentListNode): | ||
| 216 | "comments/list.html" | 219 | "comments/list.html" |
| 217 | ] | 220 | ] |
| 218 | qs = self.get_queryset(context) | 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 | return liststr | 228 | return liststr |
| 225 | else: | 229 | else: |
| 226 | return '' | 230 | return '' |
Please
register
or
login
to post a comment