Created
January 10, 2014 00:51
-
-
Save ksysctl/8345017 to your computer and use it in GitHub Desktop.
Get objects by specific day
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # created_at is a DateTime field | |
| from datetime import datetime | |
| today = datetime.now() | |
| objs = MyModel.objects.filter( | |
| created_at__day=today.day, | |
| created_at__month=today.month, | |
| created_at__year=today.year | |
| ) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment