Hello, 

I know somewhat about this situation.
I was a beginner some months ago :-)

the situation is : 
you change something in a model (add a non-nullable field)
when you send « makemigrations" the ORM needs to get a value for the new fields 
just because it’s non-nullable
before modifying anything in the database.

choice 1 - you could enter a valid value directly in the terminal windows and 
the next time you add a new line in your database, you provide a value for this 
field and everything will goes well.

choice 2 - you stop the migrations and change the properties of your new field 
in the model itself (provide a default value, or transform the field in a 
nullable field)

hope it’s help!
see you

Dominique 


ad...@tradom.ca
ad...@tradom.ca



> Le 5 mai 2017 à 23:08, Er. Rv Ranga <errvrang...@gmail.com> a écrit :
> 
>  python manage.py makemigrations blog
> 
> You are trying to add a non-nullable field 'body' to post without a default; 
> we can't do that (the database needs something to populate existing rows).
> Please select a fix:
>  1) Provide a one-off default now (will be set on all existing rows with a 
> null value for this column)
>  2) Quit, and let me add a default in models.py
> Select an option: 
> 
> what is this and how we solve it
> 
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/django-users/4fd75ea1-3963-45bb-8411-7e3edf7d960c%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/2A637441-88BC-4F88-BFB0-C7213FF2FD94%40tradom.ca.
For more options, visit https://groups.google.com/d/optout.

Reply via email to