@@ -0,0 +1,852 @@
+from datetime import date%0Afrom datetime import timedelta%0A%0Afrom django.utils import timezone%0A%0Afrom books.models import Transaction%0A%0A%0Adef get_months_transactions():%0A    today = timezone.now()%0A    first_day_of_a_month = date(today.year, today.month, 1)%0A    qs = Transaction.objects.filter(created__gte=first_day_of_a_month)%0A    return qs%0A%0A%0Adef get_last_months_transactions():%0A    first_day_of_a_month = timezone.now().replace(day=1)%0A    last_month = first_day_of_a_month - timedelta(days=1)%0A    first_day_of_last_month = date(last_month.year, last_month.month, 1)%0A    qs = Transaction.objects.filter(created__gte=first_day_of_last_month)%0A    return qs%0A%0A%0Adef get_this_years_transactions():%0A    today = timezone.now()%0A    first_day_of_this_year = date(today.year, 1, 1)%0A    qs = Transaction.objects.filter(created__gte=first_day_of_this_year)%0A    return qs%0A

Add helper functions for domain logic