Im upgrading my django project from 1.8 to 2.2.0(Using Python 3.6 from virtualenv). I have done the below changes.
I tried to run the server, still it says "TypeError: init () missing 1 required positional argument: 'on_delete' and it is pointing to /usr2/santhosh/myproject/myapp/migrations/0002_abc.py
What should I do now? Do I need to delete all the migration files from the app and re-run python manage.py migrate or what?? Help me you are aware.
Migration files are still just python files so you need to update all references inside those too.
If you want an easy way to do this, take a look at Easy way to set on_delete across entire application
That message means that you forgot to change a FK. Use this to know what models are.
`cat [your_model].py | egrep -i --color -o 'models\.ForeignKey\((.*?)' | egrep -i -v 'on_delete'`,
don't forget to doing this in every type of relationship, not just ForeignKey types, also OneToOne ...etc.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.