Django表单根本不保存

时间:2019-03-26 07:45:11

标签: django

我已经在管理页面中注册了表单,而表单数据不仅仅保存在管理页面中显示的类的名称。终端不会给我错误。我怎么可能做错了

这是我的views.py

    def details_investor_business(request):
        Invest_form=Investor_form(request.POST)
        business_form=Business_owner_form(request.POST)
        if Invest_form.is_valid():
            iform=Invest_form.save()
        if business_form.is_valid():
            bform=business_form.save()
        context={}
        context['Iform']=Invest_form
        context['Bform']=business_form
        return render(request,'detail.html',context)

forms.py

      class Investor_form(forms.ModelForm):
         class Meta:
             model=Investor_Registration
             fields=("__all__")

models.py

     class Investor_Registration(models.Model):

           investor_fullname=models.CharField(default="Jon   Samuel",max_length=50,null="True")
           Address=models.TextField(default='Resendential Address')
           Age=models.IntegerField()
           Gender=models.CharField(choices=gender,max_length=50)
           Figi_Username=models.CharField(default='Figi Username',blank=True,max_length=50)
           Next_of_Kin=models.CharField(default='Next of kin Name',max_length=50)
           Next_of_Kin_Address=models.TextField(default='Address of Next of kin',max_length=100)
           Bank_Name=models.CharField(default='GTB',max_length=50)
           Bank_Type=models.CharField(choices=typeBank,max_length=50)


     def __str__(self):
             return(self.investor_fullname,    self.Address,self.Age,self.Gender,self.Figi_Username,self.Next_of_Kin,self.Next_of_Kin_Address,self.Bank_Name,self.Bank_Type)

0 个答案:

没有答案