WeekArchiveView和日期

时间:2015-06-20 14:06:13

标签: django

我有WeekArchiveClass的子类:

class CallWeekArchiveView(WeekArchiveView):
    queryset = Call.objects.all()
    date_field = "dispatched"
    make_object_list = True
    allow_future = True
    allow_empty = True

当我查看/ call / archive / 2015 / week / 24 /我得到的日期在6/14到6/20范围内,但根据http://www.epochconverter.com/date-and-time/weeknumbers-by-year.php,日期应该从星期一6/8到太阳6/14。

我想要做的主要事情是我正在尝试的当前周的默认值:

utc = pytz.timezone('UTC')
today = datetime.now(utc)
...
call_archive = '/call/archive/%d/week/%d' % ( today.year, today.isocalendar()[1] )

call_archive/call/archive/2015/week/25,今天似乎是正确的/call/archive/2015/week/24

根据周/ 24的示例视图,当我转到该网址为空时出现问题,因为日期范围似乎是错误的。

那么,为什么,当我去x1<-c('a','b','c','d','a') x2<-c('b','e','g') x3<-c('c','a','h','j') x4<-c('d','l','m','o','p','x','y','z') x5<-c('f','q','a') 时,日期是6/14到6/20呢?

作为参考,我在Django 1.8和Python 3.4,但我怀疑这不是问题的一部分。

0 个答案:

没有答案