我在下面有两个循环,第一个是timand,第二个是共享的。我想知道如何将每个结果分配给shared [“ score”]?造成我在下面尝试过的事情,我分配了shared [“ score”] = timang [“ score”]仅返回1 1 1...。此外,如何在python中返回多个响应
返回响应(shared_data,tomon_dat,status = status.HTTP_200_OK)可以吗?
#result of timang
Result: 0
Result: 1
Result: 0
Result: 0
Result: 1
Result: 1
for timang in tomon_dat:
tm_ins = QuestionaireAnswerModel.objects.get(id=timang["id"])
timang["score"] = tm_ins.score
timang["id"] = tm_ins.id
datatest = timang["score"]
for shared in shared_data:
questionaire_ins = QuestionaireModel.objects.get(random_code=shared["random_code"])
shared["title"] = questionaire_ins.title
shared["sub_title"] = questionaire_ins.sub_title
shared["idddd"] = questionaire_ins.id
answer_ins = SharedQuestionaire.objects.get(id=shared["id"])
shared["is_answered"] = (QuestionaireAnswerModel.objects.filter(shared_questionaire=answer_ins).count()) > 0
shared["score"] = timang["score"]