You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
61 lines
2.0 KiB
61 lines
2.0 KiB
from django.db import models
|
|
|
|
|
|
class XX(models.Model):
|
|
title = models.CharField(verbose_name="名称", max_length=32)
|
|
image = models.FileField(verbose_name="头像", upload_to="avatar/")
|
|
|
|
|
|
class Admin(models.Model):
|
|
""" 管理员 """
|
|
username = models.CharField(verbose_name="用户名", max_length=32)
|
|
password = models.CharField(verbose_name="密码", max_length=64)
|
|
|
|
def __str__(self):
|
|
return self.username
|
|
|
|
|
|
class Department(models.Model):
|
|
"""电影类别"""
|
|
title = models.CharField(verbose_name='标题', max_length=32)
|
|
|
|
def __str__(self):
|
|
return self.title
|
|
|
|
|
|
class UserInfo(models.Model):
|
|
""" 用户 """
|
|
name = models.CharField(verbose_name="姓名", max_length=16)
|
|
password = models.CharField(verbose_name="密码", max_length=64)
|
|
age = models.IntegerField(verbose_name="年龄")
|
|
account = models.DecimalField(verbose_name="账户余额", max_digits=10, decimal_places=2, default=0)
|
|
# create_time = models.DateTimeField(verbose_name="注册时间")
|
|
create_time = models.DateField(verbose_name="注册时间")
|
|
gender_choices = (
|
|
(1, "男"),
|
|
(2, "女"),
|
|
)
|
|
gender = models.SmallIntegerField(verbose_name="性别", choices=gender_choices)
|
|
|
|
class Movie(models.Model):
|
|
name = models.CharField(verbose_name="电影名称", max_length=16)
|
|
depart = models.ForeignKey(verbose_name="电影类别", to="Department", to_field="id", on_delete=models.CASCADE)
|
|
desc = models.CharField(verbose_name='影片描述', max_length=256,default = '')
|
|
|
|
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_id
|
|
admin = models.ForeignKey(verbose_name="管理员", to="Admin", on_delete=models.CASCADE)
|
|
|
|
|
|
|