From 5f7c949e9b32b88e07b9ff3266d1986e287c6e4d Mon Sep 17 00:00:00 2001 From: bettleChen <2207153529@qq.com> Date: Wed, 6 Sep 2023 14:04:23 +0800 Subject: [PATCH] delete str --- EduSystemServer/.idea/dataSources.xml | 12 ++++++++++++ EduSystemServer/EduSystemServer/settings.py | 4 ---- EduSystemServer/course/models.py | 11 ++++++----- 3 files changed, 18 insertions(+), 9 deletions(-) create mode 100644 EduSystemServer/.idea/dataSources.xml diff --git a/EduSystemServer/.idea/dataSources.xml b/EduSystemServer/.idea/dataSources.xml new file mode 100644 index 0000000..a974322 --- /dev/null +++ b/EduSystemServer/.idea/dataSources.xml @@ -0,0 +1,12 @@ + + + + + mysql.8 + true + com.mysql.cj.jdbc.Driver + jdbc:mysql://localhost:3306/edu_sys + $ProjectFileDir$ + + + \ No newline at end of file diff --git a/EduSystemServer/EduSystemServer/settings.py b/EduSystemServer/EduSystemServer/settings.py index 75318b2..34c413d 100644 --- a/EduSystemServer/EduSystemServer/settings.py +++ b/EduSystemServer/EduSystemServer/settings.py @@ -41,11 +41,7 @@ INSTALLED_APPS = [ 'Student', 'teacher', 'course', -<<<<<<< Updated upstream 'Eduadmin', -======= - # 'admin1', ->>>>>>> Stashed changes ] MIDDLEWARE = [ diff --git a/EduSystemServer/course/models.py b/EduSystemServer/course/models.py index 67b1b4b..6b746e5 100644 --- a/EduSystemServer/course/models.py +++ b/EduSystemServer/course/models.py @@ -1,6 +1,7 @@ from django.db import models -import Student.models +from teacher.models import Teacher +from Student.models import Student # Create your models here. @@ -9,7 +10,7 @@ class Course(models.Model): 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") + tid = models.ForeignKey(Teacher, to_field="tid", on_delete=models.CASCADE, name="tid") class Meta: db_table = "course" @@ -18,13 +19,13 @@ class Course(models.Model): class SC(models.Model): - sid = models.ForeignKey(to=Student.models.Student, to_field="sid", on_delete=models.CASCADE, name="sid") - cid = models.ForeignKey(to=Course.cid, to_field="cid", on_delete=models.CASCADE, name="cid") + sid = models.ForeignKey(Student, to_field="sid", on_delete=models.CASCADE, name="sid") + cid = models.ForeignKey(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 = "Eduadmin" + db_table = "sc" verbose_name = "管理员" verbose_name_plural = verbose_name unique_together = ("sid", "cid") \ No newline at end of file