表结构设计
编辑myproject/app01/models.py
class Order(models.Model): """订单""" oid = models.CharField(verbose_name="订单号", max_length=64) title = models.CharField(verbose_name="名称", max_length=32) price = models.IntegerField(verbose_name="价格") status_choices = { (1, "待支付"), (2, "已支付"), } status = models.SmallIntegerField(verbose_name="状态", choices=status_choices, default=1) admin = models.ForeignKey(verbose_name="管理员", to="Admin", on_delete=models.CASCADE)
生成数据库表
makemigrations migrate
标签:status,verbose,管理,models,choices,订单,CharField,name From: https://www.cnblogs.com/kekeeleven/p/17798453.html