From 41e76a2742ecd05eb682fb52672257e89b39690f Mon Sep 17 00:00:00 2001 From: bettleChen <2207153529@qq.com> Date: Tue, 19 Sep 2023 13:54:16 +0800 Subject: [PATCH] add javascript file --- EduSystemServer/EduSystemServer/utils.py | 2 +- EduSystemServer/course/admin.py | 8 ++++++-- EduSystemServer/course/views.py | 3 +++ EduSystemServer/dist/favicon1.ico | Bin 4286 -> 0 bytes EduSystemServer/teacher/admin.py | 1 + 5 files changed, 11 insertions(+), 3 deletions(-) delete mode 100644 EduSystemServer/dist/favicon1.ico diff --git a/EduSystemServer/EduSystemServer/utils.py b/EduSystemServer/EduSystemServer/utils.py index ae7fc00..39bb512 100644 --- a/EduSystemServer/EduSystemServer/utils.py +++ b/EduSystemServer/EduSystemServer/utils.py @@ -1,5 +1,5 @@ from functools import wraps -from django.http import HttpResponseForbidden, JsonResponse +from django.http import JsonResponse def permission(allowed_roles): diff --git a/EduSystemServer/course/admin.py b/EduSystemServer/course/admin.py index 0df0f99..9def42e 100644 --- a/EduSystemServer/course/admin.py +++ b/EduSystemServer/course/admin.py @@ -1,8 +1,11 @@ from django.contrib import admin from .models import Course, SC + # Register your models here. admin.site.site_header = '教务系统管理端' + + class CourseAdmin(admin.ModelAdmin): '''设置列表可显示的字段''' list_display = ('cid', 'name', 'type', 'credit', "tid") @@ -16,15 +19,16 @@ class CourseAdmin(admin.ModelAdmin): '''设置可编辑字段''' list_editable = ('name', 'type', 'credit', "tid") - '''按发布日期排序''' ordering = ('-credit',) search_fields = ('name', 'type', 'credit', "tid") + class ScAdmin(admin.ModelAdmin): list_display = ('student_name', 'course_name', 'middle_grade', 'end_grade') list_per_page = 5 + def student_name(self, obj): print(obj) return obj.sid.name @@ -38,4 +42,4 @@ class ScAdmin(admin.ModelAdmin): admin.site.register(Course, CourseAdmin) -admin.site.register(SC, ScAdmin) \ No newline at end of file +admin.site.register(SC, ScAdmin) diff --git a/EduSystemServer/course/views.py b/EduSystemServer/course/views.py index cd38547..fbb3c5d 100644 --- a/EduSystemServer/course/views.py +++ b/EduSystemServer/course/views.py @@ -44,6 +44,7 @@ def search_course(request): result["pageNum"] = paginator.num_pages return JsonResponse(result) + @permission(allowed_roles=["student"]) def get_course_by_student_id(request): """ @@ -61,6 +62,7 @@ def get_course_by_student_id(request): result = ResponseUtil.ok(data) return JsonResponse(result) + @permission(allowed_roles=["student"]) def delete_select_course(request): """ @@ -77,6 +79,7 @@ def delete_select_course(request): except Exception as E: return JsonResponse(ResponseUtil.error(E)) + @csrf_exempt @permission(allowed_roles=["teacher", "admin"]) def get_student_select_course(request): diff --git a/EduSystemServer/dist/favicon1.ico b/EduSystemServer/dist/favicon1.ico deleted file mode 100644 index df36fcfb72584e00488330b560ebcf34a41c64c2..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 4286 zcmds*O-Phc6o&64GDVCEQHxsW(p4>LW*W<827=Unuo8sGpRux(DN@jWP-e29Wl%wj zY84_aq9}^Am9-cWTD5GGEo#+5Fi2wX_P*bo+xO!)p*7B;iKlbFd(U~_d(U?#hLj56 zPhFkj-|A6~Qk#@g^#D^U0XT1cu=c-vu1+SElX9NR;kzAUV(q0|dl0|%h|dI$%VICy zJnu2^L*Te9JrJMGh%-P79CL0}dq92RGU6gI{v2~|)p}sG5x0U*z<8U;Ij*hB9z?ei z@g6Xq-pDoPl=MANPiR7%172VA%r)kevtV-_5H*QJKFmd;8yA$98zCxBZYXTNZ#QFk2(TX0;Y2dt&WitL#$96|gJY=3xX zpCoi|YNzgO3R`f@IiEeSmKrPSf#h#Qd<$%Ej^RIeeYfsxhPMOG`S`Pz8q``=511zm zAm)MX5AV^5xIWPyEu7u>qYs?pn$I4nL9J!=K=SGlKLXpE<5x+2cDTXq?brj?n6sp= zphe9;_JHf40^9~}9i08r{XM$7HB!`{Ys~TK0kx<}ZQng`UPvH*11|q7&l9?@FQz;8 zx!=3<4seY*%=OlbCbcae?5^V_}*K>Uo6ZWV8mTyE^B=DKy7-sdLYkR5Z?paTgK-zyIkKjIcpyO z{+uIt&YSa_$QnN_@t~L014dyK(fOOo+W*MIxbA6Ndgr=Y!f#Tokqv}n<7-9qfHkc3 z=>a|HWqcX8fzQCT=dqVbogRq!-S>H%yA{1w#2Pn;=e>JiEj7Hl;zdt-2f+j2%DeVD zsW0Ab)ZK@0cIW%W7z}H{&~yGhn~D;aiP4=;m-HCo`BEI+Kd6 z={Xwx{TKxD#iCLfl2vQGDitKtN>z|-AdCN|$jTFDg0m3O`WLD4_s#$S diff --git a/EduSystemServer/teacher/admin.py b/EduSystemServer/teacher/admin.py index 13d9891..4ca6ab7 100644 --- a/EduSystemServer/teacher/admin.py +++ b/EduSystemServer/teacher/admin.py @@ -12,4 +12,5 @@ class TeacherAdmin(admin.ModelAdmin): list_filter = ("sex", "title", "education", "dept") search_fields = ("name", "sex", "title", "education", "dept") + admin.site.register(Teacher, TeacherAdmin) \ No newline at end of file