From 0c3c41a812ffd8ba26185abe532ab3d1ae2a805a Mon Sep 17 00:00:00 2001 From: Qwann Date: Mon, 19 Dec 2016 16:36:23 +0100 Subject: [PATCH] small changes --- kfet/urls.py | 7 +++---- kfet/views.py | 7 ++++--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/kfet/urls.py b/kfet/urls.py index 09f16b17..162811dc 100644 --- a/kfet/urls.py +++ b/kfet/urls.py @@ -120,15 +120,14 @@ urlpatterns = [ url('^articles/(?P\d+)/edit$', teamkfet_required(views.ArticleUpdate.as_view()), name = 'kfet.article.update'), - # Article - Statistics - url('^articles/(?P\d+)/stat/last$', + url('^articles/(?P\d+)/stat/last/$', views.ArticleStatLastAll.as_view(), name = 'kfet.article.stat.last'), - url('^articles/(?P\d+)/stat/last/week$', + url('^articles/(?P\d+)/stat/last/week/$', views.ArticleStatLastWeek.as_view(), name = 'kfet.article.stat.last.week'), - url('^articles/(?P\d+)/stat/last/day$', + url('^articles/(?P\d+)/stat/last/day/$', views.ArticleStatLastDay.as_view(), name = 'kfet.article.stat.last.day'), diff --git a/kfet/views.py b/kfet/views.py index 848df767..ad9d9e61 100644 --- a/kfet/views.py +++ b/kfet/views.py @@ -8,7 +8,8 @@ from django.shortcuts import render, get_object_or_404, redirect from django.core.exceptions import PermissionDenied, ValidationError from django.core.cache import cache from django.views.generic import ListView, DetailView -from django.views.generic.detail import BaseListView, BaseDetailView, SingleObjectTemplateResponseMixin, MultipleObjectTemplateResponseMixin +from django.views.generic.list import BaseListView, MultipleObjectTemplateResponseMixin +from django.views.generic.detail import BaseDetailView, SingleObjectTemplateResponseMixin from django.views.generic.edit import CreateView, UpdateView, DeleteView, FormView from django.core.urlresolvers import reverse_lazy from django.contrib import messages @@ -2188,7 +2189,7 @@ class DurationStat(HybridListView): return this_monday_morning() elif self.lookup_duration_type == 'month': return this_first_month_day() - else raise ValueError('duration_type invalid') + else: raise ValueError('duration_type invalid') def get_begining_date(self, **kwargs): end_date = self.get_end_date(self, **kwargs) @@ -2198,7 +2199,7 @@ class DurationStat(HybridListView): days = 7*self.lookup_nb_duration elif self.lookup_duration_type == 'month': days = 30*self.lookup_nb_duration - else raise ValueError('this should not be happening.') + else: raise ValueError('this should not be happening.') delta = timezone.timedelta(days=days) return end_date - delta