31π
Looks like you added null=True
after created migration file. Because venue_city
is not a nullable field in your migration file
Follow these steps.
1) Drop venue_city & venue_country from your local table
3) Delete all the migration files you created for these `CharField to a ForeignKey` change
4) execute `python manage.py makemigrations`
5) execute 'python manage.py migrate'
It should work
7π
Had a similar problem i resolved it by removing the previous migration files.No technical explanation
- [Django]-Django Reverse Query in Template
- [Django]-Django post_save preventing recursion without overriding model save()
- [Django]-What is a context in Django?
6π
I solved it by just adding null = True
to both the (automatically generated) migration file that was causing the issue and in the Model. Then migrate
again and your failed migration will now succeed. As you changed it also in your model, makemigration
will detect no changes after that.
- [Django]-Case insensitive unique model fields in Django?
- [Django]-Disable session creation in Django
- [Django]-Auth.User.groups: (fields.E304) Reverse accessor for 'User.groups' clashes with reverse accessor for 'UserManage.groups'
3π
follow the below steps:-
- add null=True, blank=True in Venue model class
eg: venue_city = models.ForeignKey(City, null=True, blank=True) - delete venues.0016_auto_20160514_2141 migration file from migrations folder in your app
- then run python manage.py makemigrations
- then run python manage.py migrate
no need to drop table or remove migrations from migration tables
- [Django]-How to pass information using an HTTP redirect (in Django)
- [Django]-Check for presence in a list django template
- [Django]-How to get a list of all users with a specific permission group in Django
0π
I solved it by below:
- First delete last migration that face problem
- Then add like
venue_city = models.CharField(blank=True, null=True)
- Finally use
makemigrations
andmigrate
command
- [Django]-Django β proper way to implement threaded comments
- [Django]-In python, how do I create a timezone aware datetime from a date and time?
- [Django]-How do you dynamically hide form fields in Django?
0π
As the error says, you have a null value in the "venue_city" column.
It seems at the time of defining your model you had not included "null=True".
So it returns null because there is nothing in your βvenue_city" variable. Consider deleting the last migration file and perform another migration using
python manage.py makemigrations
and python manage.py migrate
commands.
- [Django]-How to simplify migrations in Django 1.7?
- [Django]-What is the simplest way to lock an object in Django
- [Django]-Django.core.exceptions.FieldError: Unknown field(s) (body ) specified for Comment