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 ...@@ -31,14 +31,14 @@ import itertools
import simplejson import simplejson
from django.shortcuts import render_to_response from django.shortcuts import render
from django.template import RequestContext
from django.contrib.auth.decorators import login_required from django.contrib.auth.decorators import login_required
from django.http import HttpResponseForbidden from django.http import HttpResponseForbidden
from django.db.models import Sum from django.db.models import Sum
from .models import HourlyStatistics from .models import HourlyStatistics
def calculate_totals(): def calculate_totals():
"""Caculates all totals required by the statistics display""" """Caculates all totals required by the statistics display"""
...@@ -269,11 +269,11 @@ def statistics(request): ...@@ -269,11 +269,11 @@ def statistics(request):
if not(request.user.is_superuser): return HttpResponseForbidden() if not(request.user.is_superuser): return HttpResponseForbidden()
return render_to_response('statistics/statistics.html', return render(request,
dict( 'statistics/statistics.html',
totals=calculate_totals(), dict(
hourly_chart_data=hourly_charts(), totals=calculate_totals(),
daily_chart_data=daily_charts(), hourly_chart_data=hourly_charts(),
weekly_chart_data=weekly_charts(), daily_chart_data=daily_charts(),
), weekly_chart_data=weekly_charts(),
context_instance=RequestContext(request)) ))
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