django 2.X 关联 外键时会报错:TypeError: __init__() missing 1 required positional argument: ‘on_delete’

django 2.X  关联  外键时会报错:TypeError: __init__() missing 1 required positional argument: ‘on_delete’

 #python3 manage.py makemigrations

报错:

解决办法:

contact = models.ForeignKey(Contact, on_delete=models.CASCADE)

加参数:

on_delete=models.CASCADE

10 thoughts on “django 2.X 关联 外键时会报错:TypeError: __init__() missing 1 required positional argument: ‘on_delete’

  1. Pingback: albuterol usa

  2. Pingback: doctor7online.com

  3. Pingback: ciprofloxacin 500mg

  4. Pingback: buy cialis online without prescription

  5. Pingback: www.viagra.com

  6. Pingback: female viagra pills

  7. Pingback: buy naltrexone

  8. Pingback: who has tylenol on sale

  9. Pingback: where to buy chloroquine

  10. Pingback: buy chloroquine