Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我想做的是:
MyModel.filter(start_date__day__gte=25)
但这不起作用。有没有办法为日期指定 agte或 a range,但只能在当天?
gte
range
我认为这样的事情在不回退到原始查询或请求__day__gte方法的情况下是最有效的:
__day__gte
from django.db.models import Q day_filter = Q() for i in xrange(25,32): day_filter = day_filter | Q(start_date__day=i) objects = MyModel.filter(day_filter)