Django管理员:如何使用url GET参数按datetime范围过滤记录? [英] Django admin: how to filter records by datetime ranges using a url GET parameter?
问题描述
我有一个时间戳记字段的记录,我想按日期时间范围过滤Django管理员视图。
我正在寻找类似于添加到url ?timestamp__lt = 201012310715& timestamp__gte = 201012300715
^这不工作..
任何想法?谢谢!
如果以下列格式指定日期时间,我认为它有效:
YYYY-MM-DD HH:MM:SS
如下:
?datetime_field__lt = 2010-09-28 + 21:00:59& datetime_field__gt = 2010-09-22 + 00:00 :00
实际上,我不知道为什么只有这种格式正常工作,如果在将来的版本中这样继续工作, / p>
I have records with a timestamp field, and I'd like to filter their Django admin view by datetime ranges.
I'm looking for something like adding to the url ?timestamp__lt=201012310715×tamp__gte=201012300715
^ this doesn't work..
Any ideas? Thanks!
I think it works if you specify the datetime in the following format:
YYYY-MM-DD HH:MM:SS
The query string would then look something like:
?datetime_field__lt=2010-09-28+21:00:59&datetime_field__gt=2010-09-22+00:00:00
Actually, I have no idea why only this format is working and if this will continue to work like this in future releases.
这篇关于Django管理员:如何使用url GET参数按datetime范围过滤记录?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!