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.
posts = Post.objects.filter(author=member.user, xyz=xyz_id, pub_date >= datetime.datetime.now()-7)
我想根据作者和 xyz 的要求提取所有帖子,这些帖子将来自过去 7 天。仅过去 7 天的结果。我知道这是错误的,但我不知道如何编码。
from datetime import datetime, timedelta posts = Post.objects.filter(author=member.user, xyz=xzy_id, pub_date__gte=datetime.now()-timedelta(days=7))