質問は自明です。変数は、reply_list です。
def db_query():
chat_data = {}
queries = A.objects.filter(is_responded = 0)
for query in queries:
replies = []
c_id = query.conversation_id
b_ids = json.loads(query.sent_to)
b_ids = b_ids["business_ids"]
for index in range(len(b_ids)):
b_ids[index] = int(b_ids[index])
for b_id in b_ids:
representative_reply = B.objects.filter(conversation_id = c_id , b_id = b_id)
user_reply = A.objects.filter(conversation_id = c_id)
replies.append(chain(representative_reply , user_reply))
reply_list =[]
for reply in replies:
for r in reply:
reply_list.append(r.u_query)
print reply_list # prints the complete list. But when inside the loop , prints only the last appended value..........SEE DOWN........
business_data = C.objects.filter(b_id = b_id)
for data in business_data:
print reply_list # prints only the last appended value .... Why?
私が望むのは、完全な reply_list をbusiness_data
ループ内に出力することです。
任意の提案をお願いします。私が間違っているところ。