Skip to content
Snippets Groups Projects
Commit 076175e9 authored by Samuel GAIST's avatar Samuel GAIST
Browse files

[statistics][views] Moved from render_to_response to render

render_to_response is deprecated in Django 2.0 and render has
been available since 1.3. It's shorter to write and avoids the
writing of context_instance=RequestContext(request) in each of
its call.
parent a3f99091
No related branches found
No related tags found
2 merge requests!2551.4.x,!238Upgrade to django 1.11
......@@ -31,14 +31,14 @@ import itertools
import simplejson
from django.shortcuts import render_to_response
from django.template import RequestContext
from django.shortcuts import render
from django.contrib.auth.decorators import login_required
from django.http import HttpResponseForbidden
from django.db.models import Sum
from .models import HourlyStatistics
def calculate_totals():
"""Caculates all totals required by the statistics display"""
......@@ -269,11 +269,11 @@ def statistics(request):
if not(request.user.is_superuser): return HttpResponseForbidden()
return render_to_response('statistics/statistics.html',
dict(
totals=calculate_totals(),
hourly_chart_data=hourly_charts(),
daily_chart_data=daily_charts(),
weekly_chart_data=weekly_charts(),
),
context_instance=RequestContext(request))
return render(request,
'statistics/statistics.html',
dict(
totals=calculate_totals(),
hourly_chart_data=hourly_charts(),
daily_chart_data=daily_charts(),
weekly_chart_data=weekly_charts(),
))
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment