1.必须要导入models包
from django.db import models
2.自定义表名: db_table = 'tb_name',位置Model类的Meta中
如下图:

表中显示的结果:

模型间三种关系
一对一 OneToOneField
一对多 ForeignKey 表与字段间的约束关系
多对多 ManyToManyField
1.必须要导入models包
from django.db import models
2.自定义表名: db_table = 'tb_name',位置Model类的Meta中
如下图:
表中显示的结果:
模型间三种关系
一对一 OneToOneField
一对多 ForeignKey 表与字段间的约束关系
多对多 ManyToManyField
本文标题:浅谈modes.py
本文链接:https://www.haomeiwen.com/subject/zmytvttx.html
网友评论