diff --git a/EduSystemServer/.idea/EduSystemServer.iml b/EduSystemServer/.idea/EduSystemServer.iml index 02a9ee7..258a1c1 100644 --- a/EduSystemServer/.idea/EduSystemServer.iml +++ b/EduSystemServer/.idea/EduSystemServer.iml @@ -14,7 +14,7 @@ - + diff --git a/EduSystemServer/.idea/dataSources.xml b/EduSystemServer/.idea/dataSources.xml index a974322..a5ca85d 100644 --- a/EduSystemServer/.idea/dataSources.xml +++ b/EduSystemServer/.idea/dataSources.xml @@ -8,5 +8,14 @@ jdbc:mysql://localhost:3306/edu_sys $ProjectFileDir$ + + mysql.8 + true + true + $PROJECT_DIR$/EduSystemServer/settings.py + com.mysql.cj.jdbc.Driver + jdbc:mysql://127.0.0.1:3306/edu_sys + $ProjectFileDir$ + \ No newline at end of file diff --git a/EduSystemServer/.idea/misc.xml b/EduSystemServer/.idea/misc.xml index fea17c1..d56657a 100644 --- a/EduSystemServer/.idea/misc.xml +++ b/EduSystemServer/.idea/misc.xml @@ -1,4 +1,4 @@ - + \ No newline at end of file diff --git a/EduSystemServer/Eduadmin/models.py b/EduSystemServer/Eduadmin/models.py index c061404..5b573f8 100644 --- a/EduSystemServer/Eduadmin/models.py +++ b/EduSystemServer/Eduadmin/models.py @@ -4,8 +4,8 @@ from django.db import models class Admin(models.Model): - username = models.CharField(max_length=32, primary_key=True, name="username", verbose_name="管理员账号") - password = models.CharField(max_length=128, name="password", verbose_name="管理员密码") + username = models.CharField(max_length=32, primary_key=True, name="username", verbose_name="管理员账号", blank=True) + password = models.CharField(max_length=128, name="password", verbose_name="管理员密码", blank=True) class Meta: db_table = "Eduadmin" diff --git a/EduSystemServer/Student/models.py b/EduSystemServer/Student/models.py index e3a2b11..48c8358 100644 --- a/EduSystemServer/Student/models.py +++ b/EduSystemServer/Student/models.py @@ -3,17 +3,18 @@ from django.db import models # Create your models here. class Student(models.Model): - sid = models.IntegerField(primary_key=True, verbose_name="学生编号", name="sid") - username = models.CharField(max_length=30, verbose_name="用户名称", name="s_username") - password = models.CharField(max_length=100, verbose_name="密码", name="s_password") - s_name = models.CharField(max_length=100, verbose_name="姓名", name="s_name") - sex = models.CharField(max_length=4, verbose_name="性别", name="s_sex") - grade = models.IntegerField(verbose_name="年级", name="s_grade") - class_name = models.CharField(max_length=50, verbose_name="班级", name="s_class_name") - major = models.CharField(max_length=50, verbose_name="专业名称", name="s_major") + sid = models.AutoField(primary_key=True, verbose_name="学生编号", name="sid") + username = models.CharField(max_length=30, verbose_name="用户名称", name="s_username", blank=True) + password = models.CharField(max_length=100, verbose_name="密码", name="s_password", blank=True) + s_name = models.CharField(max_length=100, verbose_name="姓名", name="s_name", blank=True) + sex = models.CharField(max_length=4, verbose_name="性别", name="s_sex", blank=True) + grade = models.CharField(max_length=20, verbose_name="年级", name="s_grade", blank=True) + class_name = models.CharField(max_length=50, verbose_name="班级", name="s_class_name", blank=True) + major = models.CharField(max_length=50, verbose_name="专业名称", name="s_major", blank=True) def to_dict(self): - return {"sid": self.sid, "s_name": self.s_name} + return {"sid": self.sid, "s_name": self.s_name, "username": self.username, "password": self.password, + "s_sex": self.sex, "s_grade": self.grade, "class_name": self.class_name, "major": self.major} class Meta: db_table = "student" diff --git a/EduSystemServer/course/models.py b/EduSystemServer/course/models.py index 6b746e5..b2fda46 100644 --- a/EduSystemServer/course/models.py +++ b/EduSystemServer/course/models.py @@ -7,8 +7,8 @@ from Student.models import Student # Create your models here. class Course(models.Model): 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") + c_name = models.CharField(max_length=255, verbose_name="课程名称", name="c_name", blank=True) + type = models.CharField(max_length=128, verbose_name="课程类型", name="c_type", blank=True) credit = models.IntegerField(verbose_name="课程学分", name="credit") tid = models.ForeignKey(Teacher, to_field="tid", on_delete=models.CASCADE, name="tid") @@ -28,4 +28,4 @@ class SC(models.Model): db_table = "sc" verbose_name = "管理员" verbose_name_plural = verbose_name - unique_together = ("sid", "cid") \ No newline at end of file + unique_together = ("sid", "cid") diff --git a/EduSystemServer/teacher/models.py b/EduSystemServer/teacher/models.py index 4eca1f1..d6ce4c4 100644 --- a/EduSystemServer/teacher/models.py +++ b/EduSystemServer/teacher/models.py @@ -4,11 +4,11 @@ from django.db import models # Create your models here. class Teacher(models.Model): tid = models.AutoField(primary_key=True, verbose_name="教师编号", name="tid") - t_name = models.CharField(max_length=255, verbose_name="教师名称", name="t_name") - sex = models.CharField(max_length=128, verbose_name="教师性别", name="t_sex") - title = models.CharField(max_length=128, verbose_name="教师职称", name="t_title") - education = models.CharField(max_length=128, verbose_name="教师学历", name="t_education") - dept = models.CharField(max_length=128, verbose_name="教师所属院系", name="t_dept") + t_name = models.CharField(max_length=255, verbose_name="教师名称", name="t_name", blank=True) + sex = models.CharField(max_length=128, verbose_name="教师性别", name="t_sex", blank=True) + title = models.CharField(max_length=128, verbose_name="教师职称", name="t_title", blank=True) + education = models.CharField(max_length=128, verbose_name="教师学历", name="t_education", blank=True) + dept = models.CharField(max_length=128, verbose_name="教师所属院系", name="t_dept", blank=True) class Meta: db_table = "teacher"