Skip to content
Advertisement

Error : “You are trying to add a non-nullable field”

I defined below model and getting

error : You are trying to add a non-nullable field 'user' to videodata without a default; we can't do that

models.py

JavaScript

Where i am doing wrong????

Advertisement

Answer

As the error says, your user field on VideoData is not allowing nulls, so you either need to give it a default user or allow nulls. Easiest way is to allow nulls.

JavaScript

or have a default user

JavaScript
User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement