Frequently used functions and constants about datetime in Django projects
pip install django-datetime-helpers
# Quering all Users who join today
users = User.objects.filter(
created_at__date=today()
)
# Quering all Users who join in last 12 hours
users = User.objects.filter(
created_at__gte=secons_ago(12 * HOUR)
)
# Declaring constanst
USER_SOMETHING_TIMEOUT = 5 * MINUTE
# Waiting for something
time.sleep(MINUTE)
For more examples see source code.