Q查询
from datetime import datetime from django.utils.timezone import now from django.db.models import Q from management.models import StudentVisit # print(now().date().year, now().month) # obj = StudentVisit.objects.create(view_nums=1, visit_day=now().date()) # obj = StudentVisit.objects.filter(Q(visit_day__year=now().year), Q(visit_day__month=now().month),Q(visit_day__day=now().day)) # print(obj) # # user_obj = User.objects.first() # print(user_obj.visit_time) # print(dt.datetime.now().date()) # user_obj.visit_time = dt.datetime.now().date() # user_obj.save() # print(user_obj.visit_time)
版权声明:本文为pungchur原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。