質問編集履歴
1
失礼しました。month_list=[]という記述と、month_list.append(month_sales)という記述を追加しました。
test
CHANGED
File without changes
|
test
CHANGED
@@ -22,9 +22,19 @@
|
|
22
22
|
|
23
23
|
sales = Sales.objects.filter(customer=customer) # 得意先別売上高をピックアップ
|
24
24
|
|
25
|
+
month_sales_list = [] # 各月の売上を入れるための空のリスト
|
26
|
+
|
25
27
|
for month in month_list:
|
26
28
|
|
27
29
|
month_sales = sales.filter(date__range=(month.start_date, month.end_date)) # 月別売上高をピックアップ
|
30
|
+
|
31
|
+
month_sales_list.append(month_sales) # 2018.1月売上、2018.2月売上、…
|
32
|
+
|
33
|
+
|
34
|
+
|
35
|
+
# ここで、customerにmonth_listというアトリビュートを持たせることができれば解決するのではないかと思います。
|
36
|
+
|
37
|
+
|
28
38
|
|
29
39
|
template = loader.get_template('test/sales.html')
|
30
40
|
|