As a tester , Use django Linked databases , Are databases created by developers . If the project you are testing is django project , You can skip it without looking , Because your code can directly pull the developed code , To write tests That's all right. .
When we tested , All use reverse generation model The way to create models, Create one-to-one based on the association 、 Foreign keys and many to many , But there's a problem ,django The names of these fields will be created according to their own rules , The field names in our table are probably not named according to this rule .
The error reported above is the error reported by the foreign key Association , The solution many people give is , Let you strictly follow django The naming rules of , Avoid such mistakes . Even as a developer , I want to say : You have your own rules , The company has its own rules , What if the company has other rules ???
The solution is , Use db_column To define the field names in the table ,model The attribute names of are strictly in accordance with django Naming rules for