I am very new to django and was able to finish the tutorial on djangoproject.com without any errors. I am now going through the Django REST framework tutorial found at http:
Agree with Rishikesh. I too tried to solve this issue for a long time. This will be solved with either or both of 2 methods-
1.Try deleting the migrations in the app's migrations folder(except init.py) and then running makemigrations command
2.If that doesn't work, try renaming the model (this is the last resort and might get a little messy but will work for sure.If django asks "did you rename the model? just press N.").Hope it helps..:)
If your issue is like mine, then this a workaround. The good news is that you wont have to delete your db.
Check that there isn't some other model that uses this model as a reference.
django.db.utils.OperationalError: no such column: parts_part_type.blah
This was only happening to me because I had another model called "product" in a different app called "products" that referenced this model.
part = models.ForeignKey("parts.Part", related_name="some part", limit_choices_to={'part_type':Part_Type.objects.get(prefix='PART')},)
My solution was:
python manage.py makemigrations; python manage.py migrate
python manage.py makemigrations; python manage.py migrate
Technically I think I need to change the limit_choices_to
reference so
You did every thing correct, I have been gone through same problem.
First delete you db and migrations
I solved my adding name of my app in makemigrations
:
python manage.py makemigrations appname
python manage.py migrate
This will definitely work.
Anyone coming here:
Remove all migrations Remove db.sqlite file
redo migrations