small changes

This commit is contained in:
Qwann 2016-12-19 16:36:23 +01:00
parent 4da9327666
commit 0c3c41a812
2 changed files with 7 additions and 7 deletions

View file

@ -120,15 +120,14 @@ urlpatterns = [
url('^articles/(?P<pk>\d+)/edit$',
teamkfet_required(views.ArticleUpdate.as_view()),
name = 'kfet.article.update'),
# Article - Statistics
url('^articles/(?P<pk>\d+)/stat/last$',
url('^articles/(?P<pk>\d+)/stat/last/$',
views.ArticleStatLastAll.as_view(),
name = 'kfet.article.stat.last'),
url('^articles/(?P<pk>\d+)/stat/last/week$',
url('^articles/(?P<pk>\d+)/stat/last/week/$',
views.ArticleStatLastWeek.as_view(),
name = 'kfet.article.stat.last.week'),
url('^articles/(?P<pk>\d+)/stat/last/day$',
url('^articles/(?P<pk>\d+)/stat/last/day/$',
views.ArticleStatLastDay.as_view(),
name = 'kfet.article.stat.last.day'),

View file

@ -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