摘要:
model对应数据库表,model的实例则对应表中的一条记录. from blog.models import Blog
b = Blog(name='Beatles Blog', tagline='All the latest Beatles news.')
#调用save后才会在表中生成记录,b.id才会有值,因为id是数据库生成的
#此处save相当于调用了insert语句
b.save... 阅读全文
摘要:
model对应数据库表,model的实例则对应表中的一条记录. from blog.models import Blog
b = Blog(name='Beatles Blog', tagline='All the latest Beatles news.')
#调用save后才会在表中生成记录,b.id才会有值,因为id是数据库生成的
#此处save相当于调用了insert语句
b.save... 阅读全文
|