Skip to content

Instantly share code, notes, and snippets.

@jjangdm
Created February 24, 2013 14:50
Show Gist options
  • Save jjangdm/5024100 to your computer and use it in GitHub Desktop.
Save jjangdm/5024100 to your computer and use it in GitHub Desktop.
import datetime
today = datetime.datetime.now()
income_list = []
outcome_list = []
item_number_list = Item.objects.all().values_list("item_number", flat=True)
for month in range(1,13):
for n in item_number_list:
temp = sum(Income.objects.filter(date__year=today.year, date__month="%s" %n).values_list("money",flat=True))
income_list.append(temp)
for month in range(1,13):
for n in item_number_list:
temp = sum((Outcome.objects.filter(date__year=today.year, date__month="%s" %n).values_list("money",flat=True))
outcome_list.append(temp)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment