Django创建模型_模型层

1.在项目Mysite下创建应用bms

2.在bms下的models.py文件中创建模型

from django.db import models
# Create your models here.
class Bookinfo(models.Model):
    book_id = models.AutoField(primary_key=True)
    book_category = models.CharField(max_length=32)
    book_name = models.CharField(max_length=64)
    book_author = models.CharField(max_length=32)
    book_price = models.DecimalField(max_digits=8, decimal_places=2)
    book_pubdate = models.DateField()
    book_publish = models.CharField(max_length=32)

原文地址:https://www.cnblogs.com/apollo1616/p/9840354.html