Why Is Django Manytomanyfield Causing Admin Interface To Crash? Why Is No Through Table Being Created?
Why is this line users_favorited_by = models.ManyToManyField('auth.User') or this one, which causes the same error: users_favorited_by = models.ManyToManyField(User) in this mode
Solution 1:
I think your database is in an inconsistent state through all this commenting/migrating/uncommenting. Try dropping your db completely, deleting your migration files, and running makemigrations and migrate again.
Solution 2:
This is how I executed @DanielRoseman's advice, using two shells to my Ubuntu machine, both starting in the "main" user's command prompt:
- First, delete all
"000*"files from/home/jeffy/django_files/django_test/billyjoel/migrationsand/home/jeffy/django_files/django_test/billyjoel/migrations/__pycache__ - Shell one
sudo su - postgres- postgres command prompt:
dropdb django_test_dbcreatedb django_test_dbpsql django_test_db\dt public.*(should display no tables)
- Shell two
source /home/jeffy/django_files/django_test_venv/bin/activatecd /home/jeffy/django_files/django_test(the directory containingmanage.py)python manage.py makemigrationspython manage.py migrate
- Shell one:
- Verify it worked with
psql django_test_db\dt public.*(should display your Django tables)
- Verify it worked with
Post a Comment for "Why Is Django Manytomanyfield Causing Admin Interface To Crash? Why Is No Through Table Being Created?"