Last active
December 30, 2017 16:09
-
-
Save mrts/1131aa7d0a0c621af2234f64abba37e7 to your computer and use it in GitHub Desktop.
Add on_delete=models.CASCADE to Django models automatically (Django 2.0 migration)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
find . -name models.py | xargs sed -i 's/\(ForeignKey(\w\+\)/\1, on_delete=models.CASCADE/; s/\(OneToOneField(\w\+\)/\1, on_delete=models.CASCADE/' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment