1、Django模型(Model)
models.py
class Person(models.Model):
p_name = models.CharField(max_length=16,unique=True)
p_age = models.IntegerField(default=18,db_column='age')
#False 代表男,True代表女
p_sex= models.BooleanField(default=False,db_column='sex')
class Meta:
db_table='People'
DDL
create table People
(
id int auto_increment
primary key,
p_name varchar(16) not null,
age int not null,
sex tinyint(1) not null,
constraint p_name
unique (p_name)
);