美文网首页
Django基础:开发中关于外键设置

Django基础:开发中关于外键设置

作者: 25岁学Python | 来源:发表于2020-01-08 16:27 被阅读0次

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这样就有关联关系,但是不会受他约数


推荐Python大牛在线分享技术 扣qun:855408893

领域:web开发,爬虫,数据分析,数据挖掘,人工智能

零基础到项目实战,7天学习上手做项目

相关文章

网友评论

      本文标题:Django基础:开发中关于外键设置

      本文链接:https://www.haomeiwen.com/subject/dnuloctx.html