Good day! I use Django 1.11

There is a class that is in models.py . Let's call it User , in which there is a field called ID for recording user id.

How can I use QuerySet to pull all users from the ID field in the last 24 hours? Thank!

  • one
    You can create in the table an additional column "Created" of type datetime. - Nikita
  • @Nikita and without it in any way? - Milkiweed Gtlt
  • No How does the ORM need to know when which records are created? - Sergey Gornostaev Nov.
  • @SergeyGornostaev understood) thank you all for the answers - Milkiweed Gtlt
  • If you inherit your User from django.contrib.auth.models.AbstractUser then you already have id , last_login and date_joined . Maybe I misunderstood the question? How do you define a user "in the last 24 hours"? - Vasiliy Rusin

0