diff --git a/EduSystemServer/API/__pycache__/__init__.cpython-36.pyc b/EduSystemServer/API/__pycache__/__init__.cpython-36.pyc index b56f4bb..1cdcee1 100644 Binary files a/EduSystemServer/API/__pycache__/__init__.cpython-36.pyc and b/EduSystemServer/API/__pycache__/__init__.cpython-36.pyc differ diff --git a/EduSystemServer/API/__pycache__/admin.cpython-36.pyc b/EduSystemServer/API/__pycache__/admin.cpython-36.pyc index c91b932..8a33f39 100644 Binary files a/EduSystemServer/API/__pycache__/admin.cpython-36.pyc and b/EduSystemServer/API/__pycache__/admin.cpython-36.pyc differ diff --git a/EduSystemServer/API/__pycache__/apps.cpython-36.pyc b/EduSystemServer/API/__pycache__/apps.cpython-36.pyc index 188bc42..34ea207 100644 Binary files a/EduSystemServer/API/__pycache__/apps.cpython-36.pyc and b/EduSystemServer/API/__pycache__/apps.cpython-36.pyc differ diff --git a/EduSystemServer/API/__pycache__/models.cpython-36.pyc b/EduSystemServer/API/__pycache__/models.cpython-36.pyc index 869a6d7..c6ebf5d 100644 Binary files a/EduSystemServer/API/__pycache__/models.cpython-36.pyc and b/EduSystemServer/API/__pycache__/models.cpython-36.pyc differ diff --git a/EduSystemServer/API/__pycache__/urls.cpython-36.pyc b/EduSystemServer/API/__pycache__/urls.cpython-36.pyc index f201a2d..11787a8 100644 Binary files a/EduSystemServer/API/__pycache__/urls.cpython-36.pyc and b/EduSystemServer/API/__pycache__/urls.cpython-36.pyc differ diff --git a/EduSystemServer/API/__pycache__/views.cpython-36.pyc b/EduSystemServer/API/__pycache__/views.cpython-36.pyc index c6dff3e..8049115 100644 Binary files a/EduSystemServer/API/__pycache__/views.cpython-36.pyc and b/EduSystemServer/API/__pycache__/views.cpython-36.pyc differ diff --git a/EduSystemServer/API/migrations/__pycache__/__init__.cpython-36.pyc b/EduSystemServer/API/migrations/__pycache__/__init__.cpython-36.pyc index 865e2e3..5f2b7c3 100644 Binary files a/EduSystemServer/API/migrations/__pycache__/__init__.cpython-36.pyc and b/EduSystemServer/API/migrations/__pycache__/__init__.cpython-36.pyc differ diff --git a/EduSystemServer/EduSystemServer/__pycache__/__init__.cpython-36.pyc b/EduSystemServer/EduSystemServer/__pycache__/__init__.cpython-36.pyc index 9685251..16ddec0 100644 Binary files a/EduSystemServer/EduSystemServer/__pycache__/__init__.cpython-36.pyc and b/EduSystemServer/EduSystemServer/__pycache__/__init__.cpython-36.pyc differ diff --git a/EduSystemServer/EduSystemServer/__pycache__/settings.cpython-36.pyc b/EduSystemServer/EduSystemServer/__pycache__/settings.cpython-36.pyc index b4f55f2..e486a14 100644 Binary files a/EduSystemServer/EduSystemServer/__pycache__/settings.cpython-36.pyc and b/EduSystemServer/EduSystemServer/__pycache__/settings.cpython-36.pyc differ diff --git a/EduSystemServer/EduSystemServer/__pycache__/urls.cpython-36.pyc b/EduSystemServer/EduSystemServer/__pycache__/urls.cpython-36.pyc index ace669c..a96a4a8 100644 Binary files a/EduSystemServer/EduSystemServer/__pycache__/urls.cpython-36.pyc and b/EduSystemServer/EduSystemServer/__pycache__/urls.cpython-36.pyc differ diff --git a/EduSystemServer/EduSystemServer/__pycache__/wsgi.cpython-36.pyc b/EduSystemServer/EduSystemServer/__pycache__/wsgi.cpython-36.pyc index f431aeb..892c4d1 100644 Binary files a/EduSystemServer/EduSystemServer/__pycache__/wsgi.cpython-36.pyc and b/EduSystemServer/EduSystemServer/__pycache__/wsgi.cpython-36.pyc differ diff --git a/EduSystemServer/EduSystemServer/settings.py b/EduSystemServer/EduSystemServer/settings.py index 8d79069..028a695 100644 --- a/EduSystemServer/EduSystemServer/settings.py +++ b/EduSystemServer/EduSystemServer/settings.py @@ -44,7 +44,7 @@ INSTALLED_APPS = [ 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', - 'corsheaders', + # 'corsheaders', 'API', 'Student', 'teacher', @@ -60,7 +60,7 @@ MIDDLEWARE = [ 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', 'django.middleware.clickjacking.XFrameOptionsMiddleware', - 'corsheaders.middleware.CorsMiddleware', + # 'corsheaders.middleware.CorsMiddleware', 'django.middleware.common.CommonMiddleware', # 'API.middle.AuthMiddleware', ] diff --git a/EduSystemServer/EduSystemServer/urls.py b/EduSystemServer/EduSystemServer/urls.py index 7cfa7f1..51e7063 100644 --- a/EduSystemServer/EduSystemServer/urls.py +++ b/EduSystemServer/EduSystemServer/urls.py @@ -16,26 +16,15 @@ Including another URLconf from django.contrib import admin from django.urls import path, include from API.views import login, get_user_info -<<<<<<< Updated upstream - -======= ->>>>>>> Stashed changes urlpatterns = [ path('Eduadmin/', admin.site.urls), path('api/', include(("API.urls", "api"), namespace="api")), -<<<<<<< Updated upstream -======= -<<<<<<< Updated upstream ->>>>>>> Stashed changes path('teacher/', include(("teacher.urls", "teacher"), namespace="teacher")), path('student/', include(("Student.urls", "student"), namespace="student")), path('course/', include(("course.urls", "course"), namespace="course")), -======= - path('student/', include(("Student.urls", "studnet"), namespace="student")), ->>>>>>> Stashed changes path('login', login), path('userinfo', get_user_info), ] diff --git a/EduSystemServer/Eduadmin/__pycache__/__init__.cpython-36.pyc b/EduSystemServer/Eduadmin/__pycache__/__init__.cpython-36.pyc index 582a262..35a4596 100644 Binary files a/EduSystemServer/Eduadmin/__pycache__/__init__.cpython-36.pyc and b/EduSystemServer/Eduadmin/__pycache__/__init__.cpython-36.pyc differ diff --git a/EduSystemServer/Eduadmin/__pycache__/admin.cpython-36.pyc b/EduSystemServer/Eduadmin/__pycache__/admin.cpython-36.pyc index 3264091..683ddf2 100644 Binary files a/EduSystemServer/Eduadmin/__pycache__/admin.cpython-36.pyc and b/EduSystemServer/Eduadmin/__pycache__/admin.cpython-36.pyc differ diff --git a/EduSystemServer/Eduadmin/__pycache__/apps.cpython-36.pyc b/EduSystemServer/Eduadmin/__pycache__/apps.cpython-36.pyc index d1c72bb..79b8f93 100644 Binary files a/EduSystemServer/Eduadmin/__pycache__/apps.cpython-36.pyc and b/EduSystemServer/Eduadmin/__pycache__/apps.cpython-36.pyc differ diff --git a/EduSystemServer/Eduadmin/__pycache__/models.cpython-36.pyc b/EduSystemServer/Eduadmin/__pycache__/models.cpython-36.pyc index 6f72cda..457f21c 100644 Binary files a/EduSystemServer/Eduadmin/__pycache__/models.cpython-36.pyc and b/EduSystemServer/Eduadmin/__pycache__/models.cpython-36.pyc differ diff --git a/EduSystemServer/Eduadmin/migrations/__pycache__/0001_initial.cpython-36.pyc b/EduSystemServer/Eduadmin/migrations/__pycache__/0001_initial.cpython-36.pyc index d741676..e9ef5ad 100644 Binary files a/EduSystemServer/Eduadmin/migrations/__pycache__/0001_initial.cpython-36.pyc and b/EduSystemServer/Eduadmin/migrations/__pycache__/0001_initial.cpython-36.pyc differ diff --git a/EduSystemServer/Eduadmin/migrations/__pycache__/0002_auto_20230907_0859.cpython-36.pyc b/EduSystemServer/Eduadmin/migrations/__pycache__/0002_auto_20230907_0859.cpython-36.pyc index 7e70c2d..1c8f7ae 100644 Binary files a/EduSystemServer/Eduadmin/migrations/__pycache__/0002_auto_20230907_0859.cpython-36.pyc and b/EduSystemServer/Eduadmin/migrations/__pycache__/0002_auto_20230907_0859.cpython-36.pyc differ diff --git a/EduSystemServer/Eduadmin/migrations/__pycache__/__init__.cpython-36.pyc b/EduSystemServer/Eduadmin/migrations/__pycache__/__init__.cpython-36.pyc index 81b91e2..c92c5f4 100644 Binary files a/EduSystemServer/Eduadmin/migrations/__pycache__/__init__.cpython-36.pyc and b/EduSystemServer/Eduadmin/migrations/__pycache__/__init__.cpython-36.pyc differ diff --git a/EduSystemServer/Student/__pycache__/__init__.cpython-36.pyc b/EduSystemServer/Student/__pycache__/__init__.cpython-36.pyc index 5c27da3..d95ea93 100644 Binary files a/EduSystemServer/Student/__pycache__/__init__.cpython-36.pyc and b/EduSystemServer/Student/__pycache__/__init__.cpython-36.pyc differ diff --git a/EduSystemServer/Student/__pycache__/admin.cpython-36.pyc b/EduSystemServer/Student/__pycache__/admin.cpython-36.pyc index 6135010..b4de3db 100644 Binary files a/EduSystemServer/Student/__pycache__/admin.cpython-36.pyc and b/EduSystemServer/Student/__pycache__/admin.cpython-36.pyc differ diff --git a/EduSystemServer/Student/__pycache__/apps.cpython-36.pyc b/EduSystemServer/Student/__pycache__/apps.cpython-36.pyc index 0a6f45e..7fddfa4 100644 Binary files a/EduSystemServer/Student/__pycache__/apps.cpython-36.pyc and b/EduSystemServer/Student/__pycache__/apps.cpython-36.pyc differ diff --git a/EduSystemServer/Student/__pycache__/models.cpython-36.pyc b/EduSystemServer/Student/__pycache__/models.cpython-36.pyc index 9e60348..2118b94 100644 Binary files a/EduSystemServer/Student/__pycache__/models.cpython-36.pyc and b/EduSystemServer/Student/__pycache__/models.cpython-36.pyc differ diff --git a/EduSystemServer/Student/__pycache__/urls.cpython-36.pyc b/EduSystemServer/Student/__pycache__/urls.cpython-36.pyc index 5669db4..9a0f357 100644 Binary files a/EduSystemServer/Student/__pycache__/urls.cpython-36.pyc and b/EduSystemServer/Student/__pycache__/urls.cpython-36.pyc differ diff --git a/EduSystemServer/Student/__pycache__/views.cpython-36.pyc b/EduSystemServer/Student/__pycache__/views.cpython-36.pyc index 85f7cb6..bc4a804 100644 Binary files a/EduSystemServer/Student/__pycache__/views.cpython-36.pyc and b/EduSystemServer/Student/__pycache__/views.cpython-36.pyc differ diff --git a/EduSystemServer/Student/migrations/0002_auto_20230907_0916.py b/EduSystemServer/Student/migrations/0002_auto_20230907_0916.py index f8f5cfc..de1a609 100644 --- a/EduSystemServer/Student/migrations/0002_auto_20230907_0916.py +++ b/EduSystemServer/Student/migrations/0002_auto_20230907_0916.py @@ -12,37 +12,37 @@ class Migration(migrations.Migration): operations = [ migrations.AlterField( model_name='student', - name='s_class_name', + name='class_name', field=models.CharField(blank=True, max_length=50, verbose_name='班级'), ), migrations.AlterField( model_name='student', - name='s_grade', + name='grade', field=models.CharField(blank=True, max_length=20, verbose_name='年级'), ), migrations.AlterField( model_name='student', - name='s_major', + name='major', field=models.CharField(blank=True, max_length=50, verbose_name='专业名称'), ), migrations.AlterField( model_name='student', - name='s_name', + name='name', field=models.CharField(blank=True, max_length=100, verbose_name='姓名'), ), migrations.AlterField( model_name='student', - name='s_password', + name='password', field=models.CharField(blank=True, max_length=100, verbose_name='密码'), ), migrations.AlterField( model_name='student', - name='s_sex', + name='sex', field=models.CharField(blank=True, max_length=4, verbose_name='性别'), ), migrations.AlterField( model_name='student', - name='s_username', + name='username', field=models.CharField(blank=True, max_length=30, verbose_name='用户名称'), ), migrations.AlterField( diff --git a/EduSystemServer/Student/migrations/0003_auto_20230908_1157.py b/EduSystemServer/Student/migrations/0003_auto_20230908_1157.py new file mode 100644 index 0000000..17cf26a --- /dev/null +++ b/EduSystemServer/Student/migrations/0003_auto_20230908_1157.py @@ -0,0 +1,41 @@ +# Generated by Django 3.2.13 on 2023-09-08 11:57 + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('Student', '0002_auto_20230907_0916'), + ] + + operations = [ + migrations.RemoveField( + model_name='student', + name='class_name', + ), + migrations.RemoveField( + model_name='student', + name='grade', + ), + migrations.RemoveField( + model_name='student', + name='major', + ), + migrations.RemoveField( + model_name='student', + name='name', + ), + migrations.RemoveField( + model_name='student', + name='password', + ), + migrations.RemoveField( + model_name='student', + name='sex', + ), + migrations.RemoveField( + model_name='student', + name='username', + ), + ] diff --git a/EduSystemServer/Student/migrations/__pycache__/0001_initial.cpython-36.pyc b/EduSystemServer/Student/migrations/__pycache__/0001_initial.cpython-36.pyc index 2feafc9..25c2717 100644 Binary files a/EduSystemServer/Student/migrations/__pycache__/0001_initial.cpython-36.pyc and b/EduSystemServer/Student/migrations/__pycache__/0001_initial.cpython-36.pyc differ diff --git a/EduSystemServer/Student/migrations/__pycache__/0001_initial.cpython-37.pyc b/EduSystemServer/Student/migrations/__pycache__/0001_initial.cpython-37.pyc deleted file mode 100644 index 266d761..0000000 Binary files a/EduSystemServer/Student/migrations/__pycache__/0001_initial.cpython-37.pyc and /dev/null differ diff --git a/EduSystemServer/Student/migrations/__pycache__/0002_auto_20230907_0916.cpython-36.pyc b/EduSystemServer/Student/migrations/__pycache__/0002_auto_20230907_0916.cpython-36.pyc index 4fbf441..c87dbdd 100644 Binary files a/EduSystemServer/Student/migrations/__pycache__/0002_auto_20230907_0916.cpython-36.pyc and b/EduSystemServer/Student/migrations/__pycache__/0002_auto_20230907_0916.cpython-36.pyc differ diff --git a/EduSystemServer/Student/migrations/__pycache__/__init__.cpython-36.pyc b/EduSystemServer/Student/migrations/__pycache__/__init__.cpython-36.pyc index 06d318e..d76c4ce 100644 Binary files a/EduSystemServer/Student/migrations/__pycache__/__init__.cpython-36.pyc and b/EduSystemServer/Student/migrations/__pycache__/__init__.cpython-36.pyc differ diff --git a/EduSystemServer/Student/models.py b/EduSystemServer/Student/models.py index e0c0548..138d99b 100644 --- a/EduSystemServer/Student/models.py +++ b/EduSystemServer/Student/models.py @@ -4,38 +4,6 @@ from django.db import models # Create your models here. class Student(models.Model): sid = models.AutoField(primary_key=True, verbose_name="学生编号", name="sid") -<<<<<<< Updated upstream -======= -<<<<<<< Updated upstream ->>>>>>> Stashed changes -<<<<<<< HEAD - s_username = models.CharField(max_length=30, verbose_name="用户名称", name="s_username", blank=True) - s_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) - s_sex = models.CharField(max_length=4, verbose_name="性别", name="s_sex", blank=True) - s_grade = models.CharField(max_length=20, verbose_name="年级", name="s_grade", blank=True) - s_class_name = models.CharField(max_length=50, verbose_name="班级", name="s_class_name", blank=True) - s_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, "s_username": self.s_username, "s_password": self.s_password, - "s_sex": self.s_sex, "s_grade": self.s_grade, "class_name": self.s_class_name, "s_major": self.s_major} -======= - username = models.CharField(max_length=30, verbose_name="用户名称", name="username", blank=True) - password = models.CharField(max_length=100, verbose_name="密码", name="password", blank=True) - name = models.CharField(max_length=100, verbose_name="姓名", name="name", blank=True) - sex = models.CharField(max_length=4, verbose_name="性别", name="sex", blank=True) - grade = models.CharField(max_length=20, verbose_name="年级", name="grade", blank=True) - class_name = models.CharField(max_length=50, verbose_name="班级", name="class_name", blank=True) - major = models.CharField(max_length=50, verbose_name="专业名称", name="major", blank=True) - - def to_dict(self): - return {"sid": self.sid, "name": self.name, "username": self.username, "password": self.password, - "sex": self.sex, "grade": self.grade, "class_name": self.class_name, "major": self.major} ->>>>>>> 7b09141c358f80dd8877b8665d0d55b629db72aa -<<<<<<< Updated upstream -======= -======= username = models.CharField(max_length=30, verbose_name="用户名称", name="username", blank=True) password = models.CharField(max_length=100, verbose_name="密码", name="password", blank=True) name = models.CharField(max_length=100, verbose_name="姓名", name="name", blank=True) @@ -47,8 +15,6 @@ class Student(models.Model): def to_dict(self): return {"sid": self.sid, "name": self.name, "username": self.username, "password": self.password, "sex": self.sex, "grade": self.grade, "class_name": self.class_name, "major": self.major} ->>>>>>> Stashed changes ->>>>>>> Stashed changes class Meta: db_table = "student" diff --git a/EduSystemServer/Student/views.py b/EduSystemServer/Student/views.py index 1c05c42..0e28480 100644 --- a/EduSystemServer/Student/views.py +++ b/EduSystemServer/Student/views.py @@ -2,22 +2,15 @@ from django.shortcuts import render # Create your views here. from django.http import JsonResponse -<<<<<<< Updated upstream from .models import Student -======= -<<<<<<< HEAD - from EduSystemServer.utils import ResponseUtil from Student.models import Student -======= from .models import Student ->>>>>>> 1e084d20f30e0b66d5e309a483f87ce5cfe06c39 ->>>>>>> Stashed changes from django.views.decorators.csrf import csrf_exempt from django.http import QueryDict from io import BytesIO from django.http.multipartparser import MultiPartParser - +import json @csrf_exempt def studnets(request): diff --git a/EduSystemServer/course/__pycache__/__init__.cpython-36.pyc b/EduSystemServer/course/__pycache__/__init__.cpython-36.pyc index 633a731..58c1dc4 100644 Binary files a/EduSystemServer/course/__pycache__/__init__.cpython-36.pyc and b/EduSystemServer/course/__pycache__/__init__.cpython-36.pyc differ diff --git a/EduSystemServer/course/__pycache__/admin.cpython-36.pyc b/EduSystemServer/course/__pycache__/admin.cpython-36.pyc index 15e2b53..8b7d4ca 100644 Binary files a/EduSystemServer/course/__pycache__/admin.cpython-36.pyc and b/EduSystemServer/course/__pycache__/admin.cpython-36.pyc differ diff --git a/EduSystemServer/course/__pycache__/apps.cpython-36.pyc b/EduSystemServer/course/__pycache__/apps.cpython-36.pyc index d3bb9b5..d47ca19 100644 Binary files a/EduSystemServer/course/__pycache__/apps.cpython-36.pyc and b/EduSystemServer/course/__pycache__/apps.cpython-36.pyc differ diff --git a/EduSystemServer/course/__pycache__/models.cpython-36.pyc b/EduSystemServer/course/__pycache__/models.cpython-36.pyc index 26644a0..65c245c 100644 Binary files a/EduSystemServer/course/__pycache__/models.cpython-36.pyc and b/EduSystemServer/course/__pycache__/models.cpython-36.pyc differ diff --git a/EduSystemServer/course/migrations/0002_auto_20230907_0859.py b/EduSystemServer/course/migrations/0002_auto_20230907_0859.py index 32adfc7..6085dd4 100644 --- a/EduSystemServer/course/migrations/0002_auto_20230907_0859.py +++ b/EduSystemServer/course/migrations/0002_auto_20230907_0859.py @@ -12,12 +12,12 @@ class Migration(migrations.Migration): operations = [ migrations.AlterField( model_name='course', - name='c_name', + name='name', field=models.CharField(blank=True, max_length=255, verbose_name='课程名称'), ), migrations.AlterField( model_name='course', - name='c_type', + name='type', field=models.CharField(blank=True, max_length=128, verbose_name='课程类型'), ), ] diff --git a/EduSystemServer/course/migrations/__pycache__/0001_initial.cpython-36.pyc b/EduSystemServer/course/migrations/__pycache__/0001_initial.cpython-36.pyc index 261ad55..1d55034 100644 Binary files a/EduSystemServer/course/migrations/__pycache__/0001_initial.cpython-36.pyc and b/EduSystemServer/course/migrations/__pycache__/0001_initial.cpython-36.pyc differ diff --git a/EduSystemServer/course/migrations/__pycache__/0002_auto_20230907_0859.cpython-36.pyc b/EduSystemServer/course/migrations/__pycache__/0002_auto_20230907_0859.cpython-36.pyc index cd2e6e5..428e335 100644 Binary files a/EduSystemServer/course/migrations/__pycache__/0002_auto_20230907_0859.cpython-36.pyc and b/EduSystemServer/course/migrations/__pycache__/0002_auto_20230907_0859.cpython-36.pyc differ diff --git a/EduSystemServer/course/migrations/__pycache__/__init__.cpython-36.pyc b/EduSystemServer/course/migrations/__pycache__/__init__.cpython-36.pyc index 0226b62..9cd8417 100644 Binary files a/EduSystemServer/course/migrations/__pycache__/__init__.cpython-36.pyc and b/EduSystemServer/course/migrations/__pycache__/__init__.cpython-36.pyc differ diff --git a/EduSystemServer/teacher/__pycache__/__init__.cpython-36.pyc b/EduSystemServer/teacher/__pycache__/__init__.cpython-36.pyc index 54d34ea..566870c 100644 Binary files a/EduSystemServer/teacher/__pycache__/__init__.cpython-36.pyc and b/EduSystemServer/teacher/__pycache__/__init__.cpython-36.pyc differ diff --git a/EduSystemServer/teacher/__pycache__/admin.cpython-36.pyc b/EduSystemServer/teacher/__pycache__/admin.cpython-36.pyc index 03aee0c..473d3be 100644 Binary files a/EduSystemServer/teacher/__pycache__/admin.cpython-36.pyc and b/EduSystemServer/teacher/__pycache__/admin.cpython-36.pyc differ diff --git a/EduSystemServer/teacher/__pycache__/apps.cpython-36.pyc b/EduSystemServer/teacher/__pycache__/apps.cpython-36.pyc index ba3e038..cb932cf 100644 Binary files a/EduSystemServer/teacher/__pycache__/apps.cpython-36.pyc and b/EduSystemServer/teacher/__pycache__/apps.cpython-36.pyc differ diff --git a/EduSystemServer/teacher/__pycache__/models.cpython-36.pyc b/EduSystemServer/teacher/__pycache__/models.cpython-36.pyc index e71729d..274ea1f 100644 Binary files a/EduSystemServer/teacher/__pycache__/models.cpython-36.pyc and b/EduSystemServer/teacher/__pycache__/models.cpython-36.pyc differ diff --git a/EduSystemServer/teacher/__pycache__/urls.cpython-36.pyc b/EduSystemServer/teacher/__pycache__/urls.cpython-36.pyc index 5ccba58..6124825 100644 Binary files a/EduSystemServer/teacher/__pycache__/urls.cpython-36.pyc and b/EduSystemServer/teacher/__pycache__/urls.cpython-36.pyc differ diff --git a/EduSystemServer/teacher/__pycache__/views.cpython-36.pyc b/EduSystemServer/teacher/__pycache__/views.cpython-36.pyc index fa1a25b..66359c0 100644 Binary files a/EduSystemServer/teacher/__pycache__/views.cpython-36.pyc and b/EduSystemServer/teacher/__pycache__/views.cpython-36.pyc differ diff --git a/EduSystemServer/teacher/migrations/0002_auto_20230907_0859.py b/EduSystemServer/teacher/migrations/0002_auto_20230907_0859.py index 496b1c5..856bbc4 100644 --- a/EduSystemServer/teacher/migrations/0002_auto_20230907_0859.py +++ b/EduSystemServer/teacher/migrations/0002_auto_20230907_0859.py @@ -12,27 +12,27 @@ class Migration(migrations.Migration): operations = [ migrations.AlterField( model_name='teacher', - name='t_dept', + name='dept', field=models.CharField(blank=True, max_length=128, verbose_name='教师所属院系'), ), migrations.AlterField( model_name='teacher', - name='t_education', + name='education', field=models.CharField(blank=True, max_length=128, verbose_name='教师学历'), ), migrations.AlterField( model_name='teacher', - name='t_name', + name='name', field=models.CharField(blank=True, max_length=255, verbose_name='教师名称'), ), migrations.AlterField( model_name='teacher', - name='t_sex', + name='sex', field=models.CharField(blank=True, max_length=128, verbose_name='教师性别'), ), migrations.AlterField( model_name='teacher', - name='t_title', + name='title', field=models.CharField(blank=True, max_length=128, verbose_name='教师职称'), ), ] diff --git a/EduSystemServer/teacher/migrations/__pycache__/0001_initial.cpython-36.pyc b/EduSystemServer/teacher/migrations/__pycache__/0001_initial.cpython-36.pyc index ee58bd3..bac38de 100644 Binary files a/EduSystemServer/teacher/migrations/__pycache__/0001_initial.cpython-36.pyc and b/EduSystemServer/teacher/migrations/__pycache__/0001_initial.cpython-36.pyc differ diff --git a/EduSystemServer/teacher/migrations/__pycache__/0002_auto_20230907_0859.cpython-36.pyc b/EduSystemServer/teacher/migrations/__pycache__/0002_auto_20230907_0859.cpython-36.pyc index 00d8935..2ec206f 100644 Binary files a/EduSystemServer/teacher/migrations/__pycache__/0002_auto_20230907_0859.cpython-36.pyc and b/EduSystemServer/teacher/migrations/__pycache__/0002_auto_20230907_0859.cpython-36.pyc differ diff --git a/EduSystemServer/teacher/migrations/__pycache__/__init__.cpython-36.pyc b/EduSystemServer/teacher/migrations/__pycache__/__init__.cpython-36.pyc index c867ece..d4d0722 100644 Binary files a/EduSystemServer/teacher/migrations/__pycache__/__init__.cpython-36.pyc and b/EduSystemServer/teacher/migrations/__pycache__/__init__.cpython-36.pyc differ diff --git a/EduSystemServer/teacher/views.py b/EduSystemServer/teacher/views.py index 8b18a41..696fe8a 100644 --- a/EduSystemServer/teacher/views.py +++ b/EduSystemServer/teacher/views.py @@ -9,21 +9,28 @@ from django.views.decorators.csrf import csrf_exempt from io import BytesIO from django.http.multipartparser import MultiPartParser from django.http import QueryDict -from course.models import Course,SC +from course.models import Course, SC from Student.models import Student +from django.db.models import Q import json + +from EduSystemServer.utils import ResponseUtil + + @csrf_exempt def teacher(request): if request.method == "POST": teacher_information = Teacher() + teacher_information.username = request.POST.get('username') + teacher_information.password = request.POST.get('password') teacher_information.name = request.POST.get('name') teacher_information.sex = request.POST.get('sex') teacher_information.title = request.POST.get('title') teacher_information.education = request.POST.get('education') teacher_information.dept = request.POST.get('dept') teacher_information.save() - print(teacher_information.name) - return JsonResponse({'code': 200, 'msg': 'success',"data": teacher_information.to_dict()}, safe=False) + response = ResponseUtil.ok(teacher_information.to_dict(), "老师信息插入成功") + return JsonResponse(response) elif request.method == "GET": name = request.GET.get('name') @@ -56,7 +63,8 @@ def teacher(request): all_objects = Teacher.objects.all() for teacher_x in all_objects: data.append(teacher_x.to_dict()) - return JsonResponse({'code': 200, 'msg': 'success', 'data': data}, safe=False) + response = ResponseUtil.ok(data, "老师信息查询成功") + return JsonResponse(response) elif request.method == "DELETE": parser = MultiPartParser(request.META, BytesIO(request.body), request.upload_handlers, request.encoding) @@ -70,7 +78,7 @@ def teacher(request): response = {"code": 200, "message": "删除成功!", "data": info} return JsonResponse(response) except: - response = {"code": 200, "message": "删除失败,未找到老师信息!"} + response = ResponseUtil.ok("") return JsonResponse(response) elif request.method == 'PUT': put = MultiPartParser(request.META, request, request.upload_handlers, request.encoding).parse() @@ -104,22 +112,81 @@ def delete(request): def teaching_resources(request): pass @csrf_exempt -def student_performance_management(request): - if request.method == "POST": +def student_performance_management(request): # 学生成绩管理 + if request.method == "POST": # 学生成绩录入 sid = request.POST.get('sid') cid = request.POST.get('cid') middle_grade = float(request.POST.get('middle_grade')) end_grade = float(request.POST.get('end_grade')) - if middle_grade <= 100 and middle_grade >= 0: - sc = SC() - sid = Student.objects.get(sid=sid) - print(sid) - cid = Course.objects.get(cid=cid) - sc.sid = sid - sc.cid = cid - sc.middle_grade = middle_grade - sc.end_grade=end_grade - sc.save() - return JsonResponse({'code': 200, 'msg': 'success'}, safe=False) + if middle_grade <= 100 and middle_grade >= 0 and end_grade <= 100 and end_grade >= 0: + query = SC.objects.filter(sid = sid, cid =cid) + if query.exists(): # 如果学生存在,则修改学生成绩 + query.update(middle_grade = middle_grade, end_grade= end_grade) + else: # 如果学生成绩不存在,则插入学生成绩信息 + sc = SC() + sid = Student.objects.get(sid=sid) + cid = Course.objects.get(cid=cid) + sc.sid = sid + sc.cid = cid + sc.middle_grade = middle_grade + sc.end_grade=end_grade + sc.save() + filtered = SC.objects.filter(sid = sid, cid =cid) + data = filtered.values()# 将 QuerySet 对象转换为字典列表 + data = list(data) # 转换为列表以便序列化为 JSON + response = ResponseUtil.ok(data,"学生成绩录入成功") + return JsonResponse(response) else: - return JsonResponse({'code': 200, 'msg': '成绩输入有误'}, safe=False) + response = ResponseUtil.error("成绩输入有误") + return JsonResponse(response) + elif request.method == "GET": + cid = request.GET.get('cid') + c_name = request.GET.get('c_name') + sid = request.GET.get('sid') + s_name = request.GET.get('s_name') + data = [] + if c_name: + data.append(SC.objects.filter(cid__name=c_name)) + elif s_name: + data.append(SC.objects.filter(sid__name=s_name)) + elif sid and cid: + data.append(SC.objects.filter(sid=sid, cid=cid)) + elif sid: + data.append(SC.objects.filter(sid=sid)) + elif cid: + data.append(SC.objects.filter(cid=cid)) + else: + data.append(SC.objects.all()) + response = ResponseUtil.ok(list(data[0].values()), "成绩查询成功") + return JsonResponse(response) + + elif request.method == "DELETE": + put = MultiPartParser(request.META, request, request.upload_handlers, request.encoding).parse() + sid = put[0]['sid'] + print(sid) + try: + info = SC.objects.filter(sid=sid) + data = info.values() # 将 QuerySet 对象转换为字典列表 + data = list(data) # 转换为列表以便序列化为 JSON + print(info) + SC.objects.filter(sid=sid).delete() + response = ResponseUtil.ok(data,"删除成功!") + return JsonResponse(response) + except: + response = ResponseUtil.error("未找到学生成绩") + return JsonResponse(response) + elif request.method == 'PUT': + put = MultiPartParser(request.META, request, request.upload_handlers, request.encoding).parse() + # request.PUT = put[0] + print(put) + sid = put[0]['sid'] + cid = put[0]['cid'] + middle_grade = put[0]['middle_grade'] + end_grade = put[0]['end_grade'] + SC.objects.filter(sid=sid, cid=cid).update(middle_grade=middle_grade) + SC.objects.filter(sid=sid, cid=cid).update(end_grade=end_grade) + filtered = SC.objects.filter(sid=sid, cid=cid) + data = filtered.values() # 将 QuerySet 对象转换为字典列表 + data = list(data) # 转换为列表以便序列化为 JSON + response = ResponseUtil.ok(data, "学生成绩修改成功") + return JsonResponse(response)