Created
February 24, 2013 15:40
-
-
Save jjangdm/5024249 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
today = datetime.datetime.now() | |
categoryNumber_list = Category.objects.all().values_list("categoryNumber",flat=True) | |
category_list = Category.objects.all() | |
income_list = Income.objects.filter(date__year=today.year) | |
monthly_list = [] | |
for i in categoryNumber_list: | |
if int(i)<100: | |
for j in range(1,13): | |
temp_money = sum(Income.objects.filter(category__categoryNumber="%s" %i, date__year=today.year, date__month="%s" %j).values_list("money",flat=True)) | |
monthly_list.append(temp_money) | |
else: | |
for j in range(1,13): | |
temp_money = sum(Outcome.objects.filter(category__categoryNumber="%s" %i, date__year=today.year, date__month="%s" %j).values_list("money",flat=True)) | |
monthly_list.append(temp_money) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment