Home  >  Q&A  >  body text

python - django orm filters data whose date is today's date

I need to implement a query to find the update time of the current day. How to use django orm to find it

    reply_list = CusQuestions.objects.filter(is_deleted='f', crt_tm ????).order_by('-crt_tm')

This is crt_tm. I don’t know how to match the date to the current day

淡淡烟草味淡淡烟草味2683 days ago947

reply all(2)I'll reply

  • 三叔

    三叔2017-06-15 09:23:51

    CusQuestions.objects.filter(crt_tm__range=["2017-06-14", "2017-06-15"])

    reply
    0
  • PHP中文网

    PHP中文网2017-06-15 09:23:51

    Depending on what type your crt_tm is, you can use the following conditions for DateTimeField and DateField types

    crt_tm__gte=datetime.datetime.now().date()
    

    If the timestamp is saved, it will be easier to handle, there is nothing to say

    reply
    0
  • Cancelreply