Я получаю IntegrityError NOT NULL constraint failed: login_new_user.sturesidance

В моем шаблоне я определил его следующим образом,

`

<!-- residance -->
                    <div class="input-group mb-2 ">
                        <span class="input-group-text w-25" for="residance">Residence</span>
                        <input class="form-control text-bg-primary bg-opacity-10 text-dark text-opacity-50"
                            type="textarea" name="stureisidance" cols="4" rows="5" placeholder="type current address"
                            required>
                    </div>

`

В моих моделях есть такой файл .

`

 sturesidance=models.TextField()

` Вот как я создал свой объект,

`

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 )

`

Теперь я получаю ошибку IntegrityError Исключение Значение: NOT NULL constraint failed: login_new_user.sturesidance

Проверьте имя поля в html-коде. Оно должно отличаться от имени поля, определенного в Model.

In html - stureisidance
In model - sturesidance

Если вы сделаете его идентичным, это может сработать.

Вернуться на верх