Home > Net >  I am getting IntegrityError NOT NULL constraint failed: login_new_user.sturesidance
I am getting IntegrityError NOT NULL constraint failed: login_new_user.sturesidance

Time:11-24

In my template I have defined it like this,

`

<!-- residance -->
                    <div >
                        <span  for="residance">Residence</span>
                        <input 
                            type="textarea" name="stureisidance" cols="4" rows="5" placeholder="type current address"
                            required>
                    </div>

`

In my models i have this filed .

`

 sturesidance=models.TextField()

` This is how I created my object,

`

new_user.objects.create( stuname= stuname, stubirthday= stubirthday, stuphoto= stuphoto , stugemail= stugemail ,stugrade= stugrade , stuclass=  stuclass,stuentrance= stuentrance , sturesidance= sturesidance ,stuguardian= stuguardian , stugtele= stugtele , stumother= stumother ,stumothertele= stumothertele ,stuotherskills= stuotherskills ,stucertificate= stucertificate ,stuletter= stuletter ,stumedical= stumedical ,stusports= stusports ,stupassword= stupassword )

`

Now I am getting error IntegrityError Exception Value: NOT NULL constraint failed: login_new_user.sturesidance

CodePudding user response:

Check for the field's name in html code. It seems to be different from the name of the field defined in Model.

In html - stureisidance
In model - sturesidance

Once you make it identical, it might work.

  • Related