X-Git-Url: https://git.mdrn.pl/wolnelektury.git/blobdiff_plain/6abcfa9732ddf2221e4edb0f276067c4283e8796..2009fbf211892e7e25a8bf3c2fd934972b86db9a:/src/stats/views.py diff --git a/src/stats/views.py b/src/stats/views.py index 4ff85f494..93cda3797 100644 --- a/src/stats/views.py +++ b/src/stats/views.py @@ -6,6 +6,7 @@ from . import models class TopView(PermissionRequiredMixin, TemplateView): + model = models.Visits permission_required = 'stats.view_visits' template_name = 'stats/top.html' @@ -13,7 +14,7 @@ class TopView(PermissionRequiredMixin, TemplateView): ctx = super().get_context_data(**kwargs) form = forms.VisitsForm(self.request.GET) assert form.is_valid() - visits = models.Visits.objects.all() + visits = self.model.objects.all() if form.cleaned_data['date_since']: visits = visits.filter(date__gte=form.cleaned_data['date_since'].replace(day=1)) if form.cleaned_data['date_until']: @@ -27,3 +28,6 @@ class TopView(PermissionRequiredMixin, TemplateView): ctx['visits'] = visits return ctx + +class DailyTopView(TopView): + model = models.DayVisits