diff --git a/EduSystemServer/EduSystemServer/settings.py b/EduSystemServer/EduSystemServer/settings.py index ad807ba..34c413d 100644 --- a/EduSystemServer/EduSystemServer/settings.py +++ b/EduSystemServer/EduSystemServer/settings.py @@ -1,7 +1,7 @@ """ Django settings for EduSystemServer project. -Generated by 'django-admin startproject' using Django 2.2. +Generated by 'django-Eduadmin startproject' using Django 2.2. For more information on this file, see https://docs.djangoproject.com/en/2.2/topics/settings/ @@ -41,7 +41,7 @@ INSTALLED_APPS = [ 'Student', 'teacher', 'course', - 'admin', + 'Eduadmin', ] MIDDLEWARE = [ diff --git a/EduSystemServer/EduSystemServer/urls.py b/EduSystemServer/EduSystemServer/urls.py index d16d836..8e2f8a4 100644 --- a/EduSystemServer/EduSystemServer/urls.py +++ b/EduSystemServer/EduSystemServer/urls.py @@ -19,6 +19,6 @@ from django.urls import path, include import API.urls urlpatterns = [ - path('admin/', admin.site.urls), + path('Eduadmin/', admin.site.urls), path('api/', include(("API.urls", "api"), namespace="api")), ] diff --git a/EduSystemServer/admin/__init__.py b/EduSystemServer/Eduadmin/__init__.py similarity index 100% rename from EduSystemServer/admin/__init__.py rename to EduSystemServer/Eduadmin/__init__.py diff --git a/EduSystemServer/admin/admin.py b/EduSystemServer/Eduadmin/admin.py similarity index 100% rename from EduSystemServer/admin/admin.py rename to EduSystemServer/Eduadmin/admin.py diff --git a/EduSystemServer/admin/apps.py b/EduSystemServer/Eduadmin/apps.py similarity index 75% rename from EduSystemServer/admin/apps.py rename to EduSystemServer/Eduadmin/apps.py index 5bbf122..715d7e1 100644 --- a/EduSystemServer/admin/apps.py +++ b/EduSystemServer/Eduadmin/apps.py @@ -2,4 +2,4 @@ from django.apps import AppConfig class AdminConfig(AppConfig): - name = 'admin' + name = 'Eduadmin' diff --git a/EduSystemServer/admin/migrations/__init__.py b/EduSystemServer/Eduadmin/migrations/__init__.py similarity index 100% rename from EduSystemServer/admin/migrations/__init__.py rename to EduSystemServer/Eduadmin/migrations/__init__.py diff --git a/EduSystemServer/Eduadmin/models.py b/EduSystemServer/Eduadmin/models.py new file mode 100644 index 0000000..c061404 --- /dev/null +++ b/EduSystemServer/Eduadmin/models.py @@ -0,0 +1,12 @@ +from django.db import models + +# Create your models here. + + +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="管理员密码") + + class Meta: + db_table = "Eduadmin" + verbose_name = "管理员" diff --git a/EduSystemServer/admin/tests.py b/EduSystemServer/Eduadmin/tests.py similarity index 100% rename from EduSystemServer/admin/tests.py rename to EduSystemServer/Eduadmin/tests.py diff --git a/EduSystemServer/admin/views.py b/EduSystemServer/Eduadmin/views.py similarity index 100% rename from EduSystemServer/admin/views.py rename to EduSystemServer/Eduadmin/views.py diff --git a/EduSystemServer/admin/models.py b/EduSystemServer/admin/models.py deleted file mode 100644 index ff59ddb..0000000 --- a/EduSystemServer/admin/models.py +++ /dev/null @@ -1,13 +0,0 @@ -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 9968df1..67b1b4b 100644 --- a/EduSystemServer/course/models.py +++ b/EduSystemServer/course/models.py @@ -1,5 +1,7 @@ from django.db import models +import Student.models + # Create your models here. class Course(models.Model): @@ -16,12 +18,13 @@ class Course(models.Model): 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") + 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") middle_grade = models.IntegerField(name="middle_grade") end_grade = models.IntegerField(name="end_grade") class Meta: - db_table = "admin" + db_table = "Eduadmin" verbose_name = "管理员" - verbose_name_plural = verbose_name \ No newline at end of file + verbose_name_plural = verbose_name + unique_together = ("sid", "cid") \ No newline at end of file