diff --git a/EduSystemServer/admin/models.py b/EduSystemServer/admin/models.py index 71a8362..ff59ddb 100644 --- a/EduSystemServer/admin/models.py +++ b/EduSystemServer/admin/models.py @@ -1,3 +1,13 @@ from django.db import models # Create your models here. + + +class Admin(models.Model): + aid = models.AutoField(primary_key=True, name="aid") + username = models.CharField(unique=True, name="username", verbose_name="管理员账号") + password = models.CharField(name="password", verbose_name="管理员密码") + + class Meta: + db_table = "admin" + verbose_name = "管理员" diff --git a/EduSystemServer/course/models.py b/EduSystemServer/course/models.py index 28bc79f..9968df1 100644 --- a/EduSystemServer/course/models.py +++ b/EduSystemServer/course/models.py @@ -3,8 +3,25 @@ from django.db import models # Create your models here. class Course(models.Model): - cid = models.AutoField(primary_key=True, verbose_name="课程编号") - c_name = models.CharField(max_length=255, verbose_name="课程名称") - type = models.CharField(max_length=128, verbose_name="课程类型") - credit = models.IntegerField(verbose_name="课程学分") - tid = models.ForeignKey(to="teacher", to_field="tid", on_delete="") \ No newline at end of file + cid = models.AutoField(primary_key=True, verbose_name="课程编号", name="cid") + c_name = models.CharField(max_length=255, verbose_name="课程名称", name="c_name") + type = models.CharField(max_length=128, verbose_name="课程类型", name="c_type") + credit = models.IntegerField(verbose_name="课程学分", name="credit") + tid = models.ForeignKey(to="teacher", to_field="tid", on_delete=models.CASCADE, name="tid") + + class Meta: + db_table = "course" + verbose_name = "课程" + verbose_name_plural = verbose_name + + +class SC(models.Model): + sid = models.ForeignKey(to="Student", to_field="sid", on_delete=models.CASCADE, name="sid") + cid = models.ForeignKey(to="Course", to_field="cid", on_delete=models.CASCADE, name="cid") + middle_grade = models.IntegerField(name="middle_grade") + end_grade = models.IntegerField(name="end_grade") + + class Meta: + db_table = "admin" + verbose_name = "管理员" + verbose_name_plural = verbose_name \ No newline at end of file