1
def post(self, request, *args, **kwargs):
    self.company.name = request.POST['company_name']
    self.company.certification = request.POST['company_pic_url']
    self.company.save()
    return http.HttpResponseRedirect('/company')

ここで、会社はモデル インスタンスであり、名前と認証は save() 後に変更されません

でも

def post(self, request, *args, **kwargs):
    company = self.company
    company.name = request.POST['company_name']
    company.certification = request.POST['company_pic_url']
    company.save()
    return http.HttpResponseRedirect('/company')

うまくいきます 誰かがこれを説明できますか?ありがとう

4

0 に答える 0