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.

34 lines
1.5 KiB

from django.db import models
class StuInfo(models.Model):
username = models.CharField(verbose_name='用户名', max_length=32, unique=True)
password = models.CharField(verbose_name='密码', max_length=64)
name = models.CharField(verbose_name='姓名', max_length=32)
gender_choices = (
(1, ''),
(2, ''),
)
gender = models.SmallIntegerField(verbose_name='性别', choices=gender_choices)
department = models.ForeignKey(verbose_name='学院', to='Department', to_field='id', on_delete=models.CASCADE)
course = models.ManyToManyField(to='CourseInfo', through='Select')
class Department(models.Model):
department_name = models.CharField(verbose_name='学院名', max_length=32)
def __str__(self):
return self.department_name
class CourseInfo(models.Model):
course_name = models.CharField(verbose_name='课程名称', max_length=32)
course_brief = models.CharField(verbose_name='课程介绍', max_length=128, default='')
class_hour = models.SmallIntegerField(verbose_name='课时')
points = models.SmallIntegerField(verbose_name='学分')
class AdminInfo(models.Model):
username = models.CharField(verbose_name='用户名', max_length=32)
password = models.CharField(verbose_name='密码', max_length=64)
class Select(models.Model):
student = models.ForeignKey(StuInfo, verbose_name='学生', on_delete=models.CASCADE)
course = models.ForeignKey(CourseInfo, verbose_name='课程', on_delete=models.CASCADE)