Refs #27728 -- Fixed thread safety of admin template tags.

Regression in 5cc28dc752.
This commit is contained in:
Carlton Gibson 2018-02-28 16:12:50 +01:00 committed by Tim Graham
parent 4c02e3cda3
commit 94a180402c
1 changed files with 4 additions and 3 deletions

View File

@ -23,10 +23,11 @@ class InclusionAdminNode(InclusionNode):
opts = context['opts'] opts = context['opts']
app_label = opts.app_label.lower() app_label = opts.app_label.lower()
object_name = opts.object_name.lower() object_name = opts.object_name.lower()
self.filename = [ # Load template for this render call. (Setting self.filename isn't
# thread-safe.)
context.render_context[self] = context.template.engine.select_template([
'admin/%s/%s/%s' % (app_label, object_name, self.template_name), 'admin/%s/%s/%s' % (app_label, object_name, self.template_name),
'admin/%s/%s' % (app_label, self.template_name), 'admin/%s/%s' % (app_label, self.template_name),
'admin/%s' % (self.template_name,), 'admin/%s' % (self.template_name,),
] ])
return super().render(context) return super().render(context)