开发者

django datefield filter

开发者 https://www.devze.com 2022-12-11 01:12 出处:网络
I\'d like to use an object filter similar to the following Shipment.objects.filter(date__gte=datetime.date(2005,1,1))

I'd like to use an object filter similar to the following

Shipment.objects.filter(date__gte=datetime.date(2005,1,1))

However there doesn't seem to be support for compar开发者_开发知识库ison operators on datetime objects. Is there a method I'm unaware of or should I look into writing a custom filter.


I use date comparison in my code a lot and they work e.g copied a snippet from my calendar code

q.filter(start_date__gt=pay_period.start_date).order_by("start_date")
0

精彩评论

暂无评论...
验证码 换一张
取 消