a = datetime.date.today() b = a - datetime.timedelta(weeks=1) obj = TT.objects.filter(shijian__gt=b).values_list('name', flat=True) print(obj) if obj: obj = list(set(obj)) print(obj) print(type(obj)) <QuerySet ['李四', '张三', '孙斌', 'liuhua', '张飞', '赵云', '刘备']> ['李四', '孙斌', '赵云', 'liuhua', '刘备', '张飞', '张三'] <class 'list'>
时间的比较