Removing every occurrence of Requestcontext and Context

This commit is contained in:
Hodossy Szabolcs 2017-09-26 07:47:28 +02:00
parent af26da6106
commit 829d1cc522
2 changed files with 2 additions and 8 deletions

View file

@ -4,7 +4,6 @@ from django.contrib.admin.views.main import ChangeList
from django.http import HttpResponseRedirect from django.http import HttpResponseRedirect
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import ugettext_lazy as _
from django.contrib.admin.options import IncorrectLookupParameters from django.contrib.admin.options import IncorrectLookupParameters
from django import template
from django.shortcuts import render_to_response from django.shortcuts import render_to_response
import django import django
@ -253,15 +252,11 @@ class TreeEditor(admin.ModelAdmin):
'selection_note_all': selection_note_all % {'total_count': cl.result_count}, 'selection_note_all': selection_note_all % {'total_count': cl.result_count},
}) })
context.update(extra_context or {}) context.update(extra_context or {})
context_instance = template.RequestContext(
request,
context
)
return render_to_response(self.change_list_template or [ return render_to_response(self.change_list_template or [
'admin/%s/%s/change_list.html' % (app_label, opts.object_name.lower()), 'admin/%s/%s/change_list.html' % (app_label, opts.object_name.lower()),
'admin/%s/change_list.html' % app_label, 'admin/%s/change_list.html' % app_label,
'admin/change_list.html' 'admin/change_list.html'
], context=context_instance.flatten()) ], context=context)
def changelist_view(self, request, extra_context=None, *args, **kwargs): def changelist_view(self, request, extra_context=None, *args, **kwargs):
""" """

View file

@ -14,8 +14,7 @@ class CategoryTagsTest(TestCase):
Return the rendered string or raise an exception. Return the rendered string or raise an exception.
""" """
tpl = template.Template(template_string) tpl = template.Template(template_string)
ctxt = template.Context(context) return tpl.render(context)
return tpl.render(ctxt)
def testTooFewArguments(self): def testTooFewArguments(self):
""" """