比较时间

def test(request):
    t = '2019-12-23 16:25:00'
    a = datetime.strptime(t, '%Y-%m-%d %H:%M:%S')
    print(a)
    print(type(a))
    objs = Author.objects.filter(time__gt=a).all().values('id','name','time').order_by('id').distinct()
    objs = list(objs)
    return JsonResponse({'data':objs})

  

posted @ 2019-12-24 00:33  real-admin  阅读(99)  评论(0编辑  收藏  举报