Django外壳打印两次

时间:2017-12-13 10:22:00

标签: python django django-views

我的django shell中发生了一些我无法解释但不知道如何修复的东西;

def get_answer_dict(self, format = None, *args,**kwargs):
    current_user = MyUser.objects.get(id = self.kwargs['pk2']) #current_user
    print(current_user)
    survey_team = Survey.objects.get(name= 'Survey Raphael') #survey team (to change to final one)
    current_response = ResponseModel.objects.filter(user = current_user, survey = survey_team)[0] #current response
    #print(current_response)
    answer_list = current_response.answers.all()
    #print(answer_list)
    answer_dict = []
    for answer in answer_list:
        ans_body =  answer.body
        ans_json = json.loads(ans_body)
        answer_dict.append(ans_json)
    return answer_dict

事情是,在我的django shell中,用户被打印两次...... 你知道为什么吗?

enter image description here

0 个答案:

没有答案