django开发中关于外键设置
我们建模型的时候会用到ForeignKey
而由于外键的约数会导致一些保存
所有我们ctrl+左键进入源码
源码
def __init__(self,to,on_delete=None,related_name=None,related_query_name=None,limit_choices_to=None,parent_link=False,to_field=None,db_constraint=True,**kwargs):
我们要把源码中的db_constraint
设置成Flase这样就有关联关系,但是不会受他约数