diff --git a/app/apps/calendar_view/utils/calendar.py b/app/apps/calendar_view/utils/calendar.py index ffdfb9c..fe1bfeb 100644 --- a/app/apps/calendar_view/utils/calendar.py +++ b/app/apps/calendar_view/utils/calendar.py @@ -37,7 +37,12 @@ def get_transactions_by_day(year, month): # Get all transactions for the month transactions = Transaction.objects.filter( date__year=year, date__month=month - ).order_by("date") + ).order_by( + "date", + "-type", + "-is_paid", + "id", + ) # Calculate padding days needed padding_days = first_day.weekday() # Monday is 0, Sunday is 6 diff --git a/app/apps/calendar_view/views.py b/app/apps/calendar_view/views.py index a38f050..80bcf8e 100644 --- a/app/apps/calendar_view/views.py +++ b/app/apps/calendar_view/views.py @@ -66,7 +66,12 @@ def calendar_list(request, month: int, year: int): @require_http_methods(["GET"]) def calendar_transactions_list(request, day: int, month: int, year: int): date = datetime.date(year=year, month=month, day=day) - transactions = Transaction.objects.filter(date=date) + transactions = Transaction.objects.filter(date=date).order_by( + "date", + "-type", + "-is_paid", + "id", + ) return render( request,