Added a donut chart to the quota view

Moved morris.js out of the statistics plugin
This commit is contained in:
Raphael Michel
2016-09-18 19:11:44 +02:00
parent ebbd9aaee9
commit f8ce3523dc
13 changed files with 74 additions and 33 deletions

View File

@@ -9,19 +9,14 @@ from django.views.generic import TemplateView
from pretix.base.models import Item, Order, OrderPosition
from pretix.control.permissions import EventPermissionRequiredMixin
from pretix.control.views import ChartContainingView
from pretix.plugins.statistics.signals import clear_cache
class IndexView(EventPermissionRequiredMixin, TemplateView):
class IndexView(EventPermissionRequiredMixin, ChartContainingView, TemplateView):
template_name = 'pretixplugins/statistics/index.html'
permission = 'can_view_orders'
def get(self, request, *args, **kwargs):
resp = super().get(request, *args, **kwargs)
# required by raphael.js
resp['Content-Security-Policy'] = "script-src {static} 'unsafe-eval'; style-src {static} 'unsafe-inline'"
return resp
def get_context_data(self, **kwargs):
ctx = super().get_context_data(**kwargs)
tz = timezone.get_current_timezone()