Django count objects created in current month

The (current) accepted answer is incorrect. As stated in comments, maybe OP wants current month in current year. Not current month in any year. Well most people want the first.

So I would rather do

Order.objects.filter(created_at__gte=timezone.now().replace(day=1, hour=0, minute=0, second=0, microsecond=0))

The above also gets around timezone issues.


One of possible ways.

from datetime import datetime
current_month = datetime.now().month

Order.objects.filter(created_at__month=current_month)

See https://docs.djangoproject.com/en/stable/ref/models/querysets/#month for reference.