0👍
✅
https://docs.djangoproject.com/en/1.9/ref/models/querysets/#hour
o = Order.objects.filter(dateTime__hour=12)
1👍
The following will give you all the objects having hour
value as 12.
o = Order.objects.filter(dateTime__hour=12)
which can be used in place of
o = Order.objects.get(dateTime__hour=12)`
to get that one object, in case you have unique hour
values for objects.
But if already know that you have unique value of hour
then you should use
the later.
Source:stackexchange.com