django.db.utils.IntegrityError: The row in table \'main_tutorial\' with primary key \'1\' has an invalid foreign key: main_tutorial.tutorial_series_id contains a
You can simply delete all the objects in the main_tutorial table from django shell:
python manage.py shell
from main.models import Tutorial
Tutorial.objects.all().delete()
(main being the app name here)
This will delete all the objects in the Tutorial table and then makemigrations and migrate and it should work just fine.
Try to delete all the migration files exept __init__.py
and also delete db.sqlite3. After that run makemigrations and migrate again
Delete migration files from the folder except
__init__.py
Then:
python manage.py makemigrations
python manage.py migrate
Try using on_delete = models.CASCADE
without a default parameter.