Errors in Model's Feild

d = models. DateTimeField(auto_now_add=True)
raise error "TypeError "

img= models. ImageField(upload_to = ‘images/’)
raise error "you are trying to add non nullable field… " after using default also this error show again
when makemigrations command run

Hello @vermas.123, it may be possible you have created this img field later on after entering some data into the system. So now on adding some new field you need to add null=True or you can also clear the database file by deleting it. And also clear the migrations folder but make sure not to delete __init__.py file. It will work.
Pls, try this out for once and if it doesn’t work pls let me know, and feel free to ask if there is any other doubt.
Thanks :slight_smile:

1 Like

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.

1 Like