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

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

  1. Guqinz

    Somebody essentially help to make seriously posts I would state. This is the very first time I frequented your website page and thus far? I amazed with the research you made to make this particular publish incredible. Fantastic job!

  2. ferragamo belt

    I simply needed to thank you so much again. I’m not certain the things I might have achieved in the absence of the entire information revealed by you over my area of interest. It actually was an absolute troublesome difficulty for me personally, however , being able to view the professional tactic you dealt with the issue forced me to weep for happiness. Extremely thankful for the service and thus hope you comprehend what a powerful job you are doing educating men and women via your web site. I know that you haven’t encountered all of us.

  3. nike air max 97

    I wanted to compose a small remark to thank you for some of the splendid hints you are giving out here. My extended internet lookup has at the end of the day been rewarded with pleasant insight to talk about with my good friends. I ‘d believe that many of us visitors are extremely endowed to be in a decent place with many special people with useful suggestions. I feel somewhat lucky to have encountered your entire web site and look forward to so many more thrilling minutes reading here. Thank you again for a lot of things.

  4. nike react

    I am glad for writing to let you be aware of of the remarkable discovery my friend’s girl experienced browsing your web site. She realized several details, which include how it is like to possess a very effective helping mindset to have the rest with no trouble master several grueling matters. You truly did more than readers’ desires. Many thanks for imparting such practical, healthy, explanatory and in addition cool tips about that topic to Julie.

  5. satta king

    I’m not that much of a online reader to be honest but your sites really nice, keep it up! I’ll go ahead and bookmark your website to come back in the future. All the best

  6. balenciaga sneakers

    I and my guys came digesting the good information on your web blog and so immediately I had a horrible suspicion I never thanked the site owner for them. All of the men came for this reason glad to read all of them and have absolutely been taking pleasure in these things. Appreciate your getting well accommodating as well as for making a decision on these kinds of excellent information millions of individuals are really wanting to understand about. My very own honest apologies for not expressing appreciation to earlier.