From e6551c7ddb372eb3402ff6db00f4d142d8eb9a38 Mon Sep 17 00:00:00 2001 From: bettleChen <2207153529@qq.com> Date: Thu, 7 Sep 2023 16:59:36 +0800 Subject: [PATCH] add login middle .... function --- EduSystemServer/.idea/EduSystemServer.iml | 2 +- EduSystemServer/.idea/misc.xml | 2 +- .../API/__pycache__/apps.cpython-37.pyc | Bin 0 -> 370 bytes .../API/__pycache__/middle.cpython-37.pyc | Bin 0 -> 908 bytes .../API/__pycache__/urls.cpython-37.pyc | Bin 930 -> 893 bytes .../API/__pycache__/views.cpython-37.pyc | Bin 398 -> 1500 bytes EduSystemServer/API/middle.py | 23 +++++++++ EduSystemServer/API/urls.py | 3 +- EduSystemServer/API/views.py | 48 +++++++++++++++++- .../__pycache__/settings.cpython-37.pyc | Bin 2434 -> 2611 bytes .../__pycache__/urls.cpython-37.pyc | Bin 1060 -> 1195 bytes .../__pycache__/utils.cpython-37.pyc | Bin 0 -> 663 bytes EduSystemServer/EduSystemServer/settings.py | 13 ++++- EduSystemServer/EduSystemServer/urls.py | 5 +- EduSystemServer/EduSystemServer/utils.py | 10 ++++ .../Eduadmin/__pycache__/apps.cpython-37.pyc | Bin 0 -> 382 bytes .../__pycache__/models.cpython-37.pyc | Bin 741 -> 757 bytes .../Eduadmin/migrations/0001_initial.py | 6 +-- .../__pycache__/0001_initial.cpython-37.pyc | Bin 0 -> 773 bytes .../__pycache__/__init__.cpython-37.pyc | Bin 0 -> 176 bytes .../Student/__pycache__/apps.cpython-37.pyc | Bin 0 -> 382 bytes .../Student/__pycache__/models.cpython-37.pyc | Bin 445 -> 1280 bytes .../Student/__pycache__/urls.cpython-37.pyc | Bin 0 -> 318 bytes .../Student/__pycache__/views.cpython-37.pyc | Bin 0 -> 1144 bytes .../Student/migrations/0001_initial.py | 18 +++---- .../__pycache__/0001_initial.cpython-37.pyc | Bin 0 -> 1034 bytes .../__pycache__/__init__.cpython-37.pyc | Bin 0 -> 175 bytes EduSystemServer/Student/models.py | 18 +++---- EduSystemServer/Student/urls.py | 1 + EduSystemServer/Student/views.py | 17 +++++++ .../course/__pycache__/apps.cpython-37.pyc | Bin 0 -> 379 bytes .../course/__pycache__/models.cpython-37.pyc | Bin 1541 -> 1578 bytes .../course/__pycache__/views.cpython-37.pyc | Bin 0 -> 207 bytes .../course/migrations/0001_initial.py | 8 +-- .../__pycache__/0001_initial.cpython-37.pyc | Bin 0 -> 1405 bytes .../__pycache__/__init__.cpython-37.pyc | Bin 0 -> 174 bytes EduSystemServer/course/models.py | 4 +- .../teacher/__pycache__/apps.cpython-37.pyc | Bin 0 -> 382 bytes .../teacher/__pycache__/models.cpython-37.pyc | Bin 445 -> 1167 bytes .../teacher/migrations/0001_initial.py | 12 ++--- .../__pycache__/0001_initial.cpython-37.pyc | Bin 0 -> 959 bytes .../__pycache__/__init__.cpython-37.pyc | Bin 0 -> 175 bytes EduSystemServer/teacher/models.py | 14 +++-- 43 files changed, 158 insertions(+), 46 deletions(-) create mode 100644 EduSystemServer/API/__pycache__/apps.cpython-37.pyc create mode 100644 EduSystemServer/API/__pycache__/middle.cpython-37.pyc create mode 100644 EduSystemServer/API/middle.py create mode 100644 EduSystemServer/EduSystemServer/__pycache__/utils.cpython-37.pyc create mode 100644 EduSystemServer/EduSystemServer/utils.py create mode 100644 EduSystemServer/Eduadmin/__pycache__/apps.cpython-37.pyc create mode 100644 EduSystemServer/Eduadmin/migrations/__pycache__/0001_initial.cpython-37.pyc create mode 100644 EduSystemServer/Eduadmin/migrations/__pycache__/__init__.cpython-37.pyc create mode 100644 EduSystemServer/Student/__pycache__/apps.cpython-37.pyc create mode 100644 EduSystemServer/Student/__pycache__/urls.cpython-37.pyc create mode 100644 EduSystemServer/Student/__pycache__/views.cpython-37.pyc create mode 100644 EduSystemServer/Student/migrations/__pycache__/0001_initial.cpython-37.pyc create mode 100644 EduSystemServer/Student/migrations/__pycache__/__init__.cpython-37.pyc create mode 100644 EduSystemServer/course/__pycache__/apps.cpython-37.pyc create mode 100644 EduSystemServer/course/__pycache__/views.cpython-37.pyc create mode 100644 EduSystemServer/course/migrations/__pycache__/0001_initial.cpython-37.pyc create mode 100644 EduSystemServer/course/migrations/__pycache__/__init__.cpython-37.pyc create mode 100644 EduSystemServer/teacher/__pycache__/apps.cpython-37.pyc create mode 100644 EduSystemServer/teacher/migrations/__pycache__/0001_initial.cpython-37.pyc create mode 100644 EduSystemServer/teacher/migrations/__pycache__/__init__.cpython-37.pyc diff --git a/EduSystemServer/.idea/EduSystemServer.iml b/EduSystemServer/.idea/EduSystemServer.iml index 258a1c1..02a9ee7 100644 --- a/EduSystemServer/.idea/EduSystemServer.iml +++ b/EduSystemServer/.idea/EduSystemServer.iml @@ -14,7 +14,7 @@ - + diff --git a/EduSystemServer/.idea/misc.xml b/EduSystemServer/.idea/misc.xml index d56657a..fea17c1 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/API/__pycache__/apps.cpython-37.pyc b/EduSystemServer/API/__pycache__/apps.cpython-37.pyc new file mode 100644 index 0000000000000000000000000000000000000000..8bb8f3ebe78f0851ae8341a6e94f8d31621b3f02 GIT binary patch literal 370 zcmZ?b<>g`k0+nyyQo?}rV-N=hSbz)%ATCw_5-AKRj5!Rsj8Tk?4DJjmOexGQ3@Oa1 zjLpnZOerkE44SMjfvOlZ8EqM|^xw-~f`bvv_XE0#L;#jzk|);VFm!WqF(j@ literal 0 HcmV?d00001 diff --git a/EduSystemServer/API/__pycache__/middle.cpython-37.pyc b/EduSystemServer/API/__pycache__/middle.cpython-37.pyc new file mode 100644 index 0000000000000000000000000000000000000000..48cff8c6e86b2931b996bf9950d932af8ccd2324 GIT binary patch literal 908 zcmZuw&1(}u6rb7IY}T|@DFrVg_26MI^)4b-D}I1Q40s5^Vabf?*3E7@GpnR*57Od6 z6k4Q6L9qcnD5wXE2*H13t~QPN13Y-rH?xhl;DdSdX5PoX-|x*{nwY2{kh{?@w&5W3 z-5f?jz_=yN<}kO4g3=ITP=NLL4VfmlxooG2uX zJ=%Mf#+J0v{Ve$IiKJ6G?&+37!jTi@H<>ObiYK6VG|j|ZQ7gWl`<6_!;yQt{S5 ztIEX#F6y(luGd?({h4-0`;9 zMv3+_$wd;jxOP>i&4<51mMclBrmg?9A*zuwu1QNaqYZ55?nxD@Oa>+GwnMdGNz`S@ zrHs-<6Chd`&_PKUOu8)iQpTkc$IQte%|IN7qh-EOW$UH15ymm4V{np_pb+-3Pb%1T zJUoRbapiwh7CG~QXSg?TDAg58TPe$8V~o8L=|z}- v!VE+jr%zmH!`{sYM31q>FlnYU3re*uSnD}Z!4@naoiEzB0OS>~VVwK{x3BM` literal 0 HcmV?d00001 diff --git a/EduSystemServer/API/__pycache__/urls.cpython-37.pyc b/EduSystemServer/API/__pycache__/urls.cpython-37.pyc index fde68bccf12a49fa1be01b922fc5372b90bacedf..d0e5e431f9642de60e2a97c43be0f229b43d5468 100644 GIT binary patch delta 146 zcmZ3){+G?iiIp gdGRgol&r+O^nAV2qMYI)W}wNFHJM9UI2d`D06}mdw*UYD delta 183 zcmey%wun8-iIEHkydSd;MWF_XM=j)XgeCI3ln|f2fp^d}6N6sQxl6}@Nd9Pv95TbTCy-YZ>$OYu{ zfQR2W``+!}cn3MlAOqf9Fnu}8R9T`GHWCsQIYu?MNok_W_>MRpVo$ot_ zWfg}v3Q)&8;^{xI=4X#0uUB&YDE7LLvXbXbpxc4WV?1kR?e`3u!Z3}OS7WXWyIJu) zx53PR(p7eWi4YqWR zPsim>HBh^i)LE^Sbii!lm3dd|na#+YTUpxCbCFeYtShMo_+yedytKEX^Pqt5CRb^1 z^*O9`TW@;$m{~2K1~vS#lD78zcKxOFbB;OD9^`w;81^n%?@&io6U CuYsrl delta 274 zcmcb^-Nzj2#LLUY00c?jzoqN|(vLwL7+?Z29Dul31xTbYq%h_%8Hs$nU7V|0L&?32Z|sO96;_Z4x8Nkl+v73 PJCN1IAm{Ng@~{8^8^|*K diff --git a/EduSystemServer/API/middle.py b/EduSystemServer/API/middle.py new file mode 100644 index 0000000..30bc1b0 --- /dev/null +++ b/EduSystemServer/API/middle.py @@ -0,0 +1,23 @@ +from django.http import JsonResponse + + +class AuthMiddleware: + """ + 验证权限登录中间件 + """ + def __init__(self, get_response): + self.get_response = get_response + + def __call__(self, request): + path = request.path + if path in [ + "/login", + ]: + response = self.get_response(request) + return response + + session = request.session + if not session.get("username") and not session.get("type"): + return JsonResponse({"code": -1, "msg": "not login!"}, status=401) + response = self.get_response(request) + return response diff --git a/EduSystemServer/API/urls.py b/EduSystemServer/API/urls.py index 076f242..1dc6728 100644 --- a/EduSystemServer/API/urls.py +++ b/EduSystemServer/API/urls.py @@ -13,9 +13,8 @@ Including another URLconf 1. Import the include() function: from django.urls import include, path 2. Add a URL to urlpatterns: path('blog/', include('blog.urls')) """ -from API import views +from API.views import * from django.urls import path urlpatterns = [ - path("students/", views.student) ] diff --git a/EduSystemServer/API/views.py b/EduSystemServer/API/views.py index 8bda5b8..e00b419 100644 --- a/EduSystemServer/API/views.py +++ b/EduSystemServer/API/views.py @@ -1,9 +1,53 @@ +import json + from django.shortcuts import render from django.http import JsonResponse # Create your views here. +from django.views.decorators.csrf import csrf_exempt +from Student.models import * +from teacher.models import Teacher +from EduSystemServer.utils import ResponseUtil -def student(request): - return JsonResponse({"sid": 1, "sname": "张三"}) +@csrf_exempt +def login(request): + username = json.loads(request.body).get("username") + password = json.loads(request.body).get("password") + _type = json.loads(request.body).get("type") + if _type == "student": + student = Student.objects.filter(username=username, + password=password).first() + if student: + request.session["username"] = student.username + request.session["type"] = "student" + result = {"code": 0, "message": "login success!"} + else: + result = {"code": -1, "message": "username or password error!"} + elif _type == "teacher": + teacher = Teacher.objects.filter(username=username, + password=password).first() + if teacher: + request.session["username"] = teacher.username + request.session["type"] = "teacher" + result = {"code": 0, "message": "login success!"} + else: + result = ResponseUtil.error("username or password error!") + else: + result = ResponseUtil.error("type error!") + return JsonResponse(result) +@csrf_exempt +def get_user_info(request): + _type = request.GET.get("type") + username = request.GET.get("username") + if _type == "student": + student = Student.objects.filter(username=username).first() + result = ResponseUtil.ok(student.to_dict()) + elif _type == "teacher": + teacher = Teacher.objects.filter(username=username).first() + result = ResponseUtil.ok(teacher.to_dict()) + else: + result = ResponseUtil.error("type error") + request.session.clear() + return JsonResponse(result) diff --git a/EduSystemServer/EduSystemServer/__pycache__/settings.cpython-37.pyc b/EduSystemServer/EduSystemServer/__pycache__/settings.cpython-37.pyc index 8ea2b0a7dd10bad8eb8bbfcd91f22bfba018cb46..b8e0d6c45cb1f9c522220ce9659b8579c185b8ad 100644 GIT binary patch delta 519 zcmZvZO=}ZT6o%*Cx$~7|(llR9O|{>xtu~p~Dy6H&7<3>ckOT^6GlaauBoaH4Nh!D~ zxK=mWNf&kR%KQ%hK)3oQ+<8+JyYRf6hkM@ha=CEdXQtW9=e8YFWF36?h3`p4`7s;* zRze<5WJf!!=1uWtoih)TsmMDq)fdUN=u#6R~Vl5B@hV?5UFPy^$rLc)D zY~vwzu!~1{e5DT<&0`NGncGA8md-8r2P_bj#sOvUgtGEsxwJ$chqQpFQ~+-)JI}tc z3M=LMsjYrw#m#?4 zRC+T2hW@9X!=Q{)av4m;duyqo_E8;h>F!_tL;_l_2#M9Y`HJphIjhP?bPaS zyF>Xq%WA9kqSolRm3n*n)i`5?Gx|1{|5iUeMSHP delta 356 zcmYk2IZgvX5JjiD+dZ4d9(%m7n8ju_`*H!`1V|>TWCFf58ia7*0~nDKPKF%78Ri^h zBsfDHf)LskNc^w=R3(*4rOIm$(dZ%wJj>|y;|rI8WqnSYKl!FOGa0@az+wvoaZ5~n zx)IOvA638bLQ}JbWE+Yd6cS<=8a5ob@Zh6}040gg?x&O}4spO0 z9CFnh6`9m<#C05V1EOb%?nxffIc4|al&-Q|JmoAODK8e3EHx)~9Aj`D#}hFa<~`?* hLYPk|;mDS)q!Lz6PV8h|k-eRE}n*bk->D6#ifaO@WOS zbC@JFnQpP>)?@(|88%*^(jwl;Ml7j(AP2E9@-PZ8aWL~R0svll BA^-pY diff --git a/EduSystemServer/EduSystemServer/__pycache__/utils.cpython-37.pyc b/EduSystemServer/EduSystemServer/__pycache__/utils.cpython-37.pyc new file mode 100644 index 0000000000000000000000000000000000000000..284e6ad2214d4d7894f0073e9d90edaeae4c05cd GIT binary patch literal 663 zcmZuuy-EW?5Z>L(&m~+Cd;>ev=d)&bw=jSNNw$U-iOvXI9fMdPeWy%~13 zT#H(rk*#Cjms(Hx0^5*~r``*w+Cc++kMALabBj3ChWLcuWc(1M$p={MtxJ;uFY<0! zS*RT5RhCSCY@SyTEzUIiSNHvs>*nL>S^wyAaC*m2#h*z0^{ z936R4%MWC<5rQgUp`xFV-ZG`3#v5s3VspVAOYr2CW>faRGGotv&Yq)dJfX4=ZXBF{ literal 0 HcmV?d00001 diff --git a/EduSystemServer/EduSystemServer/settings.py b/EduSystemServer/EduSystemServer/settings.py index e8d1b6c..6bcb726 100644 --- a/EduSystemServer/EduSystemServer/settings.py +++ b/EduSystemServer/EduSystemServer/settings.py @@ -12,6 +12,14 @@ https://docs.djangoproject.com/en/2.2/ref/settings/ import os +CORS_ALLOW_ORIGIN_WHITELIST = [ + "http://localhost:8080", # 允许访问的来源 + "http://localhost:8000", # 允许访问的来源 + # 可以继续添加其他允许的来源 +] + +CORS_ALLOW_CREDENTIALS = True # 允许跨域请求携带凭据(例如Cookies) + # Build paths inside the project like this: os.path.join(BASE_DIR, ...) BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) @@ -29,7 +37,6 @@ ALLOWED_HOSTS = ["*"] # Application definition - INSTALLED_APPS = [ 'django.contrib.admin', 'django.contrib.auth', @@ -37,6 +44,7 @@ INSTALLED_APPS = [ 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', + 'corsheaders', 'API', 'Student', 'teacher', @@ -52,8 +60,11 @@ MIDDLEWARE = [ 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', 'django.middleware.clickjacking.XFrameOptionsMiddleware', + 'corsheaders.middleware.CorsMiddleware', + # 'API.middle.AuthMiddleware', ] + ROOT_URLCONF = 'EduSystemServer.urls' TEMPLATES = [ diff --git a/EduSystemServer/EduSystemServer/urls.py b/EduSystemServer/EduSystemServer/urls.py index c881251..6d69d65 100644 --- a/EduSystemServer/EduSystemServer/urls.py +++ b/EduSystemServer/EduSystemServer/urls.py @@ -15,11 +15,14 @@ Including another URLconf """ from django.contrib import admin from django.urls import path, include +from API.views import login, get_user_info urlpatterns = [ path('Eduadmin/', admin.site.urls), path('api/', include(("API.urls", "api"), namespace="api")), path('student/', include(("Student.urls", "student"), namespace="student")), - path('course/', include(("course.urls", "course"), namespace="course")) + path('course/', include(("course.urls", "course"), namespace="course")), + path('login', login), + path('userinfo', get_user_info), ] diff --git a/EduSystemServer/EduSystemServer/utils.py b/EduSystemServer/EduSystemServer/utils.py new file mode 100644 index 0000000..eba0b59 --- /dev/null +++ b/EduSystemServer/EduSystemServer/utils.py @@ -0,0 +1,10 @@ + + +class ResponseUtil: + @staticmethod + def ok(data, message="success!"): + return {"code": 0, "message": message, "data": data} + + @staticmethod + def error(message="error!"): + return {"code": -1, "message": message} \ No newline at end of file diff --git a/EduSystemServer/Eduadmin/__pycache__/apps.cpython-37.pyc b/EduSystemServer/Eduadmin/__pycache__/apps.cpython-37.pyc new file mode 100644 index 0000000000000000000000000000000000000000..89af00e6976bd3cb320da7ce03916882ab0a7339 GIT binary patch literal 382 zcmZ?b<>g`kf^!eQr^Ev3#~=<2umBkjKwPWv=03(p$0K~-tKq8ePiZO)&sFN{@ zIfV(RoB0;EV@hsj9z^3U4%d{@L=fLkljRmie0*MFZfbn|Ew1?Z-29Z%91xo)KEALt zF$XHc0-{$k6mbF#2NPf2fh-rRn5Rp&Je|BW=GoMlPrDXAU$^l2gtq6KcR$}fKL%(; zaAk2xYA%8moLW?tS_I;QEsseoC@9t|s4QXzngt4tVkRKL!3gI2f!v&um6(^FuLn|B c1d;>GARGZM*AL+8+Vol0P%*&q4&!{5AQp5%{ricSXaDoV~ z$qtMY*n~h#p~=@6Q-wuR?8hW2#RFo3B#R)5;Vj|FjZDJKB8)2k^lhXhA6cF delta 200 zcmey$`jnN|iIB9IwH93X;oascB5HbD?maPl+8 zRAFHt(@&G5h!-Tp2O{_<$1zDtaf6s3$s&kiI7?{qL?&ToAx448%bC;!FeL9XNdN$? CawOXT diff --git a/EduSystemServer/Eduadmin/migrations/0001_initial.py b/EduSystemServer/Eduadmin/migrations/0001_initial.py index ba7ca6f..a3e8f54 100644 --- a/EduSystemServer/Eduadmin/migrations/0001_initial.py +++ b/EduSystemServer/Eduadmin/migrations/0001_initial.py @@ -1,4 +1,4 @@ -# Generated by Django 2.1 on 2023-09-06 14:02 +# Generated by Django 2.1 on 2023-09-07 13:49 from django.db import migrations, models @@ -14,8 +14,8 @@ class Migration(migrations.Migration): migrations.CreateModel( name='Admin', fields=[ - ('username', models.CharField(max_length=32, primary_key=True, serialize=False, verbose_name='管理员账号')), - ('password', models.CharField(max_length=128, verbose_name='管理员密码')), + ('username', models.CharField(blank=True, max_length=32, primary_key=True, serialize=False, verbose_name='管理员账号')), + ('password', models.CharField(blank=True, max_length=128, verbose_name='管理员密码')), ], options={ 'verbose_name': '管理员', diff --git a/EduSystemServer/Eduadmin/migrations/__pycache__/0001_initial.cpython-37.pyc b/EduSystemServer/Eduadmin/migrations/__pycache__/0001_initial.cpython-37.pyc new file mode 100644 index 0000000000000000000000000000000000000000..11aa473ffe2f4703c271653c41832e55b240308d GIT binary patch literal 773 zcmY*XON$dh5bo)oNoMkJBZwyjPr_W5comUdSJ%_-C3_kILuad#o$Nef_e6~+McsoC zR76k^bU_6#dT_zRp8Okql^FL2c<^TRBr#Y}MO9aK)%R8PwR*imP#(h{_)ZD=VSHxyRJtY-xtG!V*Z?QJbE>}Y2lk|@>gPzjmxM4Vi}zMI1pwA0Ur(`N^h=dXSp zeVjb~<~!Qy#5~FPj6374aAUyQVeMIs(Y_k^z97P6Bm5t^df9dM=Y zWD-v9W8wd+Pre*X-#ze|bTK78V`}D-@%};3?hP1n1J$QRTD#B*bKZ%C&$L}MDRm#(TV_#`nG@a5nBM_<*Dtpx?~f)gKD2+nd_8$`IAb#X zdOSUT+eR*}k;+A~^jbpV#7tbUY%jk_yV-1B3g;MC2P0|zUkOz;(74p5wryLKp0&;} pY8BaS-_{=VdD_cXp;Is^z!%9S(3y80t7!MiY&cg9M`frt*kAUb>Tm!6 literal 0 HcmV?d00001 diff --git a/EduSystemServer/Eduadmin/migrations/__pycache__/__init__.cpython-37.pyc b/EduSystemServer/Eduadmin/migrations/__pycache__/__init__.cpython-37.pyc new file mode 100644 index 0000000000000000000000000000000000000000..f112daf9b3ab25c8abce7ae1d6a00499c99fe8e3 GIT binary patch literal 176 zcmZ?b<>g`kg12YCr-10kAOZ#$feZ&AE@lA|DGb33nv8xc8Hzx{2;yrPkn3U<^K{9U zr<0e)JexZ6Y1hK%>lQwr(Dr=u?&rJb$GE1H23HoBq~;=6!Kp=MsYM`uVoGjiUQBLg odQoCYW`16AOniK1US>&ryk0@&Ee@O9{FKt1R6CHBpMjVG0EXf?8UO$Q literal 0 HcmV?d00001 diff --git a/EduSystemServer/Student/__pycache__/apps.cpython-37.pyc b/EduSystemServer/Student/__pycache__/apps.cpython-37.pyc new file mode 100644 index 0000000000000000000000000000000000000000..2e1ea02a0660b0bad894552caa05897c76d03b70 GIT binary patch literal 382 zcmZ?b<>g`kf;nfur^Es2#~=<2umBkjKwPWv=03(p$0K~-tKq8ePiZO)&sFN{@ zIfV(RoB0-Ra7k%OYF-IM>n(OD*H4q>7Ds%1USe))eEco0`1suXl+qj!nqY89y#ELcDO2+woX?UFyhgE!xsY-ojEoaOi1o!`#9{N}y4IbAH~8IG;$ANXN2 z_LC;vfpa#FkVlY!ff2I0;TZZK^}Ti#Z8q06jLRql|9f4 zeW{YyNi#w-4h+ zy*pWXyLIn#{BS8*T~}^PazXD)w#wIoIX~o$>FBDUgo!MYaw=iam}vuTCpG?fH+gYe zxwCJ=7KBFB{3%Rpm^J0C@XYS56+Rk({3j zF|4+&z5d!<{Vt;u;A@%r}DBo|n?a$4(hr;o>G=T$ap`cR#U$e|?b%;+-~deent z>Dzxgp0YEJko%Fk9S;V6ET(63+jGFeT-XbRZjehn3cRfB^jW80?_z}LAd!ira;I8R^L&+upsT2IXRZdKGvBTyweD^O6_gGgeuob#m>@I4 zLUIt2itl2Q2Xg`kfC z3!hJDd%k)1^WF1fTvJMeD~n4~a}liI)S|M~q8O+nVnFWFE2zB1VUwGmQks)$#|SjD Om<>qqFmW(*FaiK#Ut*d7 literal 0 HcmV?d00001 diff --git a/EduSystemServer/Student/__pycache__/views.cpython-37.pyc b/EduSystemServer/Student/__pycache__/views.cpython-37.pyc new file mode 100644 index 0000000000000000000000000000000000000000..da4ae69139d67785160c07c3eee6c6abeba424ef GIT binary patch literal 1144 zcmZ8gziSjh6rS1NciFqd6bVAmXdzsaKR`r86CxH-ynwKrESsJ2a_8>tWo9-%;8I9} zNUDHX2tw{a3mY2+i`XjmcGJow1_Ub$JKxN0RGekLec#)eH}Adq_IjmKMlim#evywB zLSGd*9VQspVDg&)1QDE|6bBe9+enPm3`}jCiIv)ct!*oDQa5lhqAszCvx|0c;1QR2 zyC^7;QXSRGClC$Quyh#h5X!*vZ}F^im-24b;S{)A7dfFF0p?iD*@KX7(zGjLtaie% zi+Kay{5wDowIRKS2I~vFgSIhnqi+&pfO|N!3TA3%7tGSkDVVL9TQEm6uVAibrGj~y zl?ztVY^;a-{s2J(%0$_f0V4hjbK4Nrp0R`Lqx>q6-#3BVWC*5qNO=H2O86}ByqHY&tQnRJY=vq#>fE-5ZkRB@}6ZnNI zOj=w7l~aG%23@^I>^#K%xdM*K!qs7A>RU>4D+c zKFwPW5YwMxuI}hXV-#QiH%^38dEit5cvWn0szh?lJPS_>O&NHQAP4zHaaw=^5(SA2 z3KSDk%19Y{GIC^}^k$?lBS)b>BLf*3gku>Q%E)mzk&%=8(Z(!G{8OIlR% ziD&4h@rcm!1LD;kpJ=vj5h{o1VOHlHhDhSXs~`6kwxZ?5xcv>|&c|<`P>ID$L3;(`V2)(2!wQ|iy~pin;WN!)<$!bs zyEyu>8UJk4;*^PTljJ&Ay1sa6gZXln-gLYq$=&Uh-R;+DlId27dRp+)bE$}FmIH^? zYOWc2x=CfIYk^)j39jnHJ!pQ~ASU><;J8UMO;$=&){-PNjTSWxdn+^v+GS0 z&SSSAnf~5G>(LnRcHYNuT&1gD^eP literal 0 HcmV?d00001 diff --git a/EduSystemServer/Student/migrations/__pycache__/__init__.cpython-37.pyc b/EduSystemServer/Student/migrations/__pycache__/__init__.cpython-37.pyc new file mode 100644 index 0000000000000000000000000000000000000000..eb1c48e32023a5069db338d38e4252337a4671bb GIT binary patch literal 175 zcmZ?b<>g`kf;nfur-10kAOZ#$feZ&AE@lA|DGb33nv8xc8Hzx{2;yrfkn3U<^K{9U zr<0e)JexZ6Y1hK%>lQwr(Dr=u?&rJb$GE1H23HoBq~;=6!Kp=MsYNltC8a5;c_lHq pndwD|C7Jno#WC^mnR%Hd@$q^EmA5!-a`RJ4b5iXg`kg5zhur^Ep1#~=<2umBkjKwPWv=03(p$0K~-tKq8ePiZO)&sFN{@ zIfV(RoB0-xbAD-2aVkXTEw*GZ&rg%(7Ds%1USe))eEco0`1suXl+qj!n6x?GHc*?czLyAbW96ElZ=ZtMPg>9y>iVQJfP} zP=tsqf)EHUph!FqyaW=5Mf?qjyEw8pQGfv~F-D9tM!K1pBa2&Fw-S5gaEBR}46wm@#{fsLL-&@& zD~PyIL8P)oJn%Y3=pUm+BV@`QjX@+CYLzP@?jHzAY9}v1qt z1~-LuXafTiEU;%5cW~~4LoN~ZW;U;A#D^->mWYRl4*}GnF*A7;XEhN(6Tfw6!WQmn zV9=+ag+aG&nY;<7G2m_Gw#S9c#FZjI|9}7R`{J8Bi{Cz;zyGVU`a=jURh!7+D3;Uc zs+g+ax{$qbCZaSR31yQ!{tq{ z-`?E0_~~f=*&Su)(}`F&_}y3YcW*1VF9i(q&|I@)9j`jQp1Ej}6f#b}HRMxhSBrlxp?3b|?)-~i<{y69 z{p+Jo=kMKHe1C6o_x9rFqs7tZ-3w53rdcjV544VuXtrC%*eyA?Gnp!zVsE0sjN675VrgrBKoi<+l%FSlVCIiz(NmX3?gJDlYNmwiEIRY!nJ4Dg5KmBcfm%t&do}vt+~d{ ztY473vg-2>K0&UZr5MQlepq?9a!=5jZYpB5Y8L76S|Or*JP~7*FO`G(Wf>tfcg7nmr6e0a3B37{ovX?aWjcLMWS0)>GBv>*#PI0NYSewC+T2#OeWp$Nk}!p|e|2$Ybxw8i}b zl#z5a@z}%b+FGxMwU+cuoom&eRs$K<;|*nDKV>5vK11lZ2tRiB`yaOZpZ5;lZTnc2 zd}C9y$9dY0Wo>;!Ds9FM@Py`Zq@6gbK5obWbT$gBxN{jxWha8aVpj5+pR*>AS4||l z{6V*XW}E07Ch%2f(OmI{REbi`1fv8TL1!zSI9euRB~pK3qoxLamV6O!K9SnJ6~?kI zj~3_%I=37t*{FxN<)*e5Dys{X#U(|Z)hzW>gZ&&^lVq6)q(qw-99B%<0xNT6CVS@O zwKWV&!)IXl93>Yr(=?kIVChg8aFm}0B&5^KCV$MuaiNB=L=_2!35Z>Zc27GE9h1JcgD{Z# zSnR?{LK0hDK+yJT+yNQJYKlVXCPy)w&{L2Y=Vt3 zm$_U~+_QBSnzgVV&A_8{%zojh>CE7-S64AjXYSAyNT-t4oi;P=%wb8X6UZBk+L0zM Icf?5kFXaKong9R* diff --git a/EduSystemServer/course/__pycache__/views.cpython-37.pyc b/EduSystemServer/course/__pycache__/views.cpython-37.pyc new file mode 100644 index 0000000000000000000000000000000000000000..2244580e248d41298a7b0b19fc043de2d6b213ee GIT binary patch literal 207 zcmZ?b<>g`kg2ggFQk;PFV-N=hn1BoiATAaF5-AKRj5!Rsj8Tk?3@J>(44TX@fuanW zjJMc|Qu9($i~Ka1ZV9AhCFZ5)>lJ6@7nLNJmJ}C(%vi}#!~&$i#8)>U%f%|@>5?r^ zCohe8Hg)FHu7%InEqp$q?fK^2&v(y{aZM==t}HG|%|)<+Q;W({i(-=VON)wAW6Cm9 a%Zv32DsOSv~uUv z?4FQ76{3nLLLiV3uo9mKCy9fo}o$S{dhWe*d;D81IxbMwa|;}X58%M1gJHUp#0fwfKGVD@?2!qUJ7 z3rbiXRDgjEWvGnJ9S#n89P+qO1uys1W}YQjo_SWt`2ajPwg}-NEPw7E7-T(sZ0XDvQO_5s z@W}uC7mlM{gp2U#LbMecJ+{l>@iFh4?NjgsDfpyvuFj>~CLzlbgWfI*<*l!;KkbKc zD8nGq6D^qm#!}d%qOzMwCQ?*pFNCd3i~Hx@-=^Q(p8opb|K{-Nay7?V5W>DNCHMyVSG@eQhN@VXyi+?TsTM^cvD z8{yF#|6Mix@o@6#ZDscaLMRvEzWZwO_N_WA)|xVe{pA_S#&$uL=s8L3)2=~@ipwO^ zBnw7_m{YBr1;E-O0e=)_B8XH4y1op$5z=2Zoua)HVg#uwC!=Ch@>Wyv5EQ?%S+|rI zWHRw7)j%Q$eKtf@cR4+87y?A-(}o6A4#rTJ`?VsI#$5YUQ<;^eG5cl?;Y`0jnBKWH zdG8~|(_Wp63mRKbke#QuoW+XD-js> z<5y^#*f0pkv>CRg>PPGb4~3#&0K0{7JV#7sN2dZ7&oAsYgov3 n_So4dZnDN)3-J`i%h#STEv)BgLRDTU%J!mGKh;UDu!{LFUjMIx literal 0 HcmV?d00001 diff --git a/EduSystemServer/course/migrations/__pycache__/__init__.cpython-37.pyc b/EduSystemServer/course/migrations/__pycache__/__init__.cpython-37.pyc new file mode 100644 index 0000000000000000000000000000000000000000..189cb4f42f592b908a02583906d58ab87e04d244 GIT binary patch literal 174 zcmZ?b<>g`kg5zhur-10kAOZ#$feZ&AE@lA|DGb33nv8xc8Hzx{2;yr9kn3U<^K{9U zr<0e)JexZ6Y1hK%>lQwr(Dr=u?&rJb$GE1H23HoBq~;=6!Kp=MsYNl#`K3k0sWG{k o=|zbpnfZCeG4b)4d6^~g@p=W7w>WHa^HWN5Qtdz%egg`kf|X~#r^Es2#~=<2umBkjKwPWv=03(p$0K~-tKq8ePiZO)&sFN{@ zIfV(RoB0-RNNQqoMrsj6>n-*Y2-i=Oa&yB0oQxA6Idw&$C7Ki@q+#xh6 zphItQ+)ShS7Z5-L=4mx%Gp5aIpo6igfgxB`-!N6pnv4h9k?lQ0(K6DFH5gD{jZ zxr7;pk%Sq5Q5f6QYzw8IfpL^RzMl6;b>F^jDYC0(6LyeGzy zDlm=apGD}6BQTs~-R6SZCK&kLe9h_wnG=DFiMqK%>SDLbSQ(XZ;!$uMm2(`F6?y{q zmgC$BU5~~CPZ=mVfm`xKJOOH~e}NxqN>cLZlx|$D}0h}@xO|OG8X^< delta 215 zcmeC@+{?`8#LLUY00hf!eNS1*Fp)22qAX{G6i^_QA&N1DA&M!LIg2HQF@-6GxtA%5 zHH9UZL6h|sdq`?xaz<)VNGT6c>9eUbpYG^*zGvFg{_UDfx3~+6GIJA)D&wICh>XGgRqwnuObqS##3@hE)EOB>{ewno7vg5XGXG~B1(v2 zG$0BQQ6g#(Q4|G*_)GdKlQloUgD0(?ePr#Xi|Vhdzp1af=5n!^V>DXu2kHi6Kh>r` zXwRl-1!u_s1I=R%&C(jWrEBaO10DEX1{}3Izr!sK#yl&f_9>Q?beU_oHQ|JA(+_02 z(FF8@sygbAA~{pEf@frqSsE})2hHL&W*L~OrxiVB>RHghfE1)R_@WLOLQF!kU_vfI z@;#&g#U65KfE?~2BLn0}4;dXGV_l?{hH;ul;n;Hy$2WLQvvP2P1f7)TY+uQO%q*Z& zT|yyw=)z1?pxpPKY{lQ#J3pSrkG_?-%(sNwa75c)#X$7+FRX;*Wb%j=!PB+ zk^Q>;fXJkY5LJ_B7&?nTyp12ONdvGIMx(^n)v$MOHU9i!f9qA}%Wjk&z%mndMVELt zjj>@VcFT)|4+5EKwvsNGE9GU@PUPFR%-J?IMdTs*1>3$6 zIi4yB?J}|VALt+r7Aiz-`iicD5Fbi*(-T_4r@bDZm%t|f7EB}1A}cl=s&0xF5R bL{M^gka5>LLwquOpg`kf|X~#r-10kAOZ#$feZ&AE@lA|DGb33nv8xc8Hzx{2;yrfkn3U<^K{9U zr<0e)JexZ6Y1hK%>lQwr(Dr=u?&rJb$GE1H23HoBq~;=6!Kp=MsYNj*sfo!MKsq-w oy(qCHGe565CO$qhFS8^*Uaz3?7Kcr4eoARhsvXG2&p^xo03^IOiU0rr literal 0 HcmV?d00001 diff --git a/EduSystemServer/teacher/models.py b/EduSystemServer/teacher/models.py index d6ce4c4..db9546d 100644 --- a/EduSystemServer/teacher/models.py +++ b/EduSystemServer/teacher/models.py @@ -4,11 +4,15 @@ 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", 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) + name = models.CharField(max_length=255, verbose_name="教师名称", name="name", blank=True) + sex = models.CharField(max_length=128, verbose_name="教师性别", name="sex", blank=True) + title = models.CharField(max_length=128, verbose_name="教师职称", name="title", blank=True) + education = models.CharField(max_length=128, verbose_name="教师学历", name="education", blank=True) + dept = models.CharField(max_length=128, verbose_name="教师所属院系", name="dept", blank=True) + + def to_dict(self): + return {"tid": self.tid, "name": self.name, "sex": self.sex, + "title": self.title, "education": self.education, "dept": self.dept} class Meta: db_table = "teacher"