I believe this Context wrapping is still preserved. See this django ticket: https://code.djangoproject.com/ticket/28125. Reverting this fixes the error, so I'm assuming this is that type of render.

This commit is contained in:
Samuel Clay 2020-06-28 14:52:09 -04:00
parent 36b0823786
commit 553483ce52

View file

@ -7,7 +7,7 @@ from utils import log as logging
from django.http import HttpResponse
from django.conf import settings
from django.db import connection
from django.template import Template
from django.template import Template, Context
from apps.statistics.rstats import round_time
from utils import json_functions as json
@ -121,11 +121,11 @@ class SQLLogToConsoleMiddleware:
query['sql'] = re.sub(r'DELETE', '~FR~SBDELETE', query['sql'])
t = Template("{% for sql in sqllog %}{% if not forloop.first %} {% endif %}[{{forloop.counter}}] ~FC{{sql.time}}s~FW: {{sql.sql|safe}}{% if not forloop.last %}\n{% endif %}{% endfor %}")
if settings.DEBUG:
logging.debug(t.render({
logging.debug(t.render(Context({
'sqllog': queries,
'count': len(queries),
'time': time_elapsed,
}))
})))
times_elapsed = {
'sql': sum([float(q['time'])
for q in queries if not q.get('mongo') and