Compare commits
15 Commits
scl-branch
...
master
Author | SHA1 | Date |
---|---|---|
bettleChen | e943dc92a5 | 1 year ago |
bettleChen | 41e76a2742 | 1 year ago |
bettleChen | b0f0292c62 | 1 year ago |
bettleChen | 08b97276a5 | 1 year ago |
bettleChen | ea6a73aee3 | 1 year ago |
bettleChen | 4785eff591 | 1 year ago |
bettleChen | 37d597cd2f | 1 year ago |
bettleChen | 8daef8924f | 1 year ago |
bettleChen | 4aaf96856c | 1 year ago |
bettleChen | ce596c8c3f | 1 year ago |
bettleChen | 311eb3243f | 1 year ago |
bettleChen | 535a691e56 | 1 year ago |
bettleChen | f3658ac3bc | 1 year ago |
bettleChen | afade783a0 | 1 year ago |
bettleChen | a7f7c27b28 | 1 year ago |
@ -1,4 +1,4 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.9" project-jdk-type="Python SDK" />
|
||||
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.6" project-jdk-type="Python SDK" />
|
||||
</project>
|
@ -1,11 +1,20 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="DataSourceManagerImpl" format="xml" multifile-model="true">
|
||||
<data-source source="LOCAL" name="@localhost" uuid="9660bbaf-5fdd-4aa5-8754-d2dc6487fc96">
|
||||
<data-source source="LOCAL" name="edu_sys@localhost" uuid="fc67d607-329d-4381-af5b-a0e372257c56">
|
||||
<driver-ref>mysql.8</driver-ref>
|
||||
<synchronize>true</synchronize>
|
||||
<jdbc-driver>com.mysql.cj.jdbc.Driver</jdbc-driver>
|
||||
<jdbc-url>jdbc:mysql://localhost:3306</jdbc-url>
|
||||
<jdbc-url>jdbc:mysql://localhost:3306/edu_sys</jdbc-url>
|
||||
<working-dir>$ProjectFileDir$</working-dir>
|
||||
</data-source>
|
||||
<data-source source="LOCAL" name="Django default" uuid="ffb088a0-406e-44b2-aed0-9587474966bf">
|
||||
<driver-ref>mysql.8</driver-ref>
|
||||
<synchronize>true</synchronize>
|
||||
<imported>true</imported>
|
||||
<remarks>$PROJECT_DIR$/EduSystemServer/settings.py</remarks>
|
||||
<jdbc-driver>com.mysql.cj.jdbc.Driver</jdbc-driver>
|
||||
<jdbc-url>jdbc:mysql://127.0.0.1:3306/edu_sys</jdbc-url>
|
||||
<working-dir>$ProjectFileDir$</working-dir>
|
||||
</data-source>
|
||||
</component>
|
||||
|
@ -1,4 +1,18 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.9" project-jdk-type="Python SDK" />
|
||||
<<<<<<< Updated upstream
|
||||
=======
|
||||
<<<<<<< Updated upstream
|
||||
>>>>>>> Stashed changes
|
||||
<<<<<<< HEAD
|
||||
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.8 (2)" project-jdk-type="Python SDK" />
|
||||
=======
|
||||
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.7 (EduSystemServer)" project-jdk-type="Python SDK" />
|
||||
>>>>>>> 7b09141c358f80dd8877b8665d0d55b629db72aa
|
||||
<<<<<<< Updated upstream
|
||||
=======
|
||||
=======
|
||||
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.7 (EduSystemServer)" project-jdk-type="Python SDK" />
|
||||
>>>>>>> Stashed changes
|
||||
>>>>>>> Stashed changes
|
||||
</project>
|
@ -1,3 +1,5 @@
|
||||
from django.contrib import admin
|
||||
|
||||
# Register your models here.
|
||||
|
||||
|
||||
|
@ -1,16 +0,0 @@
|
||||
|
||||
|
||||
def jwt_response_payload_handler(token, user=None, request=None, role=None):
|
||||
|
||||
if user.username:
|
||||
name = user.username
|
||||
else:
|
||||
name = user.username
|
||||
return {
|
||||
"authenticated": True,
|
||||
'id': user.id,
|
||||
"role": role,
|
||||
'name': name,
|
||||
'username': user.username,
|
||||
'token': token,
|
||||
}
|
@ -1,108 +1,3 @@
|
||||
from django.shortcuts import render
|
||||
from django.db.models import Q
|
||||
# Create your views here.
|
||||
from teacher.models import Teacher
|
||||
from Student.models import Student
|
||||
from course.models import SC, Course
|
||||
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
|
||||
from django.http import JsonResponse
|
||||
from EduSystemServer.utils import ResponseUtil
|
||||
from .models import Admin
|
||||
|
||||
|
||||
# 修改个人信息
|
||||
@csrf_exempt
|
||||
def admin_info(request):
|
||||
if request.method == "POST":
|
||||
try:
|
||||
admin = Admin()
|
||||
admin.username = request.POST.get("username")
|
||||
admin.password = request.POST.get("password")
|
||||
admin.save()
|
||||
response = ResponseUtil.ok(admin.to_dict(), "添加成功!")
|
||||
return JsonResponse(response)
|
||||
except Exception as E:
|
||||
return JsonResponse(ResponseUtil.error(E))
|
||||
elif request.method == "GET":
|
||||
username = request.GET.get("username")
|
||||
try:
|
||||
ad_info = Admin.objects.filter(username=username).values()
|
||||
data = {
|
||||
'管理员账号': ad_info[0]['username'],
|
||||
'管理员密码': ad_info[0]['password']
|
||||
}
|
||||
response = ResponseUtil.ok(data, "查询成功!")
|
||||
return JsonResponse(response)
|
||||
except Exception as E:
|
||||
return JsonResponse(ResponseUtil.error(E))
|
||||
|
||||
|
||||
# 学生管理
|
||||
@csrf_exempt
|
||||
def student_manage(request):
|
||||
if request.method == "GET":
|
||||
student = Student.objects.all().values()
|
||||
stu_list = []
|
||||
for i in range(len(student)):
|
||||
data = {
|
||||
'学生编号': student[i]['sid'],
|
||||
'用户账号': student[i]['username'],
|
||||
'用户密码': student[i]['password'],
|
||||
'姓名': student[i]['name'],
|
||||
'性别': student[i]['sex'],
|
||||
'年级': student[i]['grade'],
|
||||
'班级': student[i]['class_name'],
|
||||
'专业': student[i]['major'],
|
||||
}
|
||||
stu_list.append(data)
|
||||
|
||||
response = ResponseUtil.ok(stu_list, "学生信息查询成功!")
|
||||
return JsonResponse(response)
|
||||
elif request.method == "POST":
|
||||
sid = request.GET.get('sid')
|
||||
try:
|
||||
stu_info = Student.objects.get(sid=sid)
|
||||
username = request.POST.get("username") or stu_info.username
|
||||
password = request.POST.get("password") or stu_info.password
|
||||
name = request.POST.get("name") or stu_info.name
|
||||
sex = request.POST.get("sex") or stu_info.sex
|
||||
grade = request.POST.get("grade") or stu_info.grade
|
||||
class_name = request.POST.get("class_name") or stu_info.class_name
|
||||
major = request.POST.get("major") or stu_info.major
|
||||
Student.objects.filter(sid=sid).update(username=username, password=password, name=name, sex=sex,
|
||||
grade=grade, class_name=class_name, major=major)
|
||||
except Exception as E:
|
||||
return JsonResponse(ResponseUtil.error(E))
|
||||
elif request.method == "DELETE":
|
||||
delete = MultiPartParser(request.META, BytesIO(request.body), request.upload_handlers, request.encoding).parse()
|
||||
sid = delete[0]['sid']
|
||||
try:
|
||||
info = Student.objects.filter(sid=sid).get().to_dict()
|
||||
Student.objects.filter(sid=sid).delete()
|
||||
response = ResponseUtil.ok(info, "删除成功!")
|
||||
return JsonResponse(response)
|
||||
except:
|
||||
return JsonResponse(ResponseUtil.error("删除失败,未找到学生信息!"))
|
||||
elif request.method == "PUT":
|
||||
put = MultiPartParser(request.META, request, request.upload_handlers, request.encoding).parse()
|
||||
sid = put[0]['sid']
|
||||
username = put[0]['username']
|
||||
name = put[0]['name']
|
||||
sex = put[0]['sex']
|
||||
grade = put[0]['grade']
|
||||
class_name = put[0]['class_name']
|
||||
major = put[0]['major']
|
||||
if Student.objects.filter(sid=sid):
|
||||
Student.objects.filter(sid=sid).update(username=username, name=name, sex=sex, grade=grade,
|
||||
class_name=class_name,
|
||||
major=major)
|
||||
else:
|
||||
return JsonResponse(ResponseUtil.error("没有查询到该同学!"))
|
||||
data = Student.objects.filter(sid=sid)[0].to_dict()
|
||||
return JsonResponse(ResponseUtil.ok(data, "修改成功!"))
|
||||
|
||||
|
||||
# Create your views here.
|
||||
|
@ -1,3 +1,14 @@
|
||||
from django.contrib import admin
|
||||
from django.core.paginator import Paginator
|
||||
|
||||
from Student.models import Student
|
||||
|
||||
|
||||
# Register your models here.
|
||||
class StudentAdmin(admin.ModelAdmin):
|
||||
list_display = ("username", "password", "name", "sex", "grade", "class_name", "major")
|
||||
list_per_page = 5
|
||||
list_filter = ('sex', 'grade', 'class_name', "major")
|
||||
search_fields = ("name", "sex", "grade", "class_name", "major")
|
||||
|
||||
admin.site.register(Student, StudentAdmin)
|
@ -1,3 +1,45 @@
|
||||
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")
|
||||
|
||||
'''设置过滤选项'''
|
||||
list_filter = ('name', 'credit', 'type')
|
||||
|
||||
'''每页显示条目数'''
|
||||
list_per_page = 5
|
||||
|
||||
'''设置可编辑字段'''
|
||||
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
|
||||
|
||||
def course_name(self, obj):
|
||||
return obj.cid.name
|
||||
|
||||
list_editable = ('middle_grade', "end_grade")
|
||||
|
||||
ordering = ('-end_grade',)
|
||||
|
||||
|
||||
admin.site.register(Course, CourseAdmin)
|
||||
admin.site.register(SC, ScAdmin)
|
||||
|
@ -0,0 +1 @@
|
||||
.login-module{margin-top:60px;position:absolute;right:500px;text-align:center;width:30%}.el-header{background-color:#b3c0d1;color:#333;line-height:60px}.transfer-footer{margin-left:20px;padding:6px 5px}
|
File diff suppressed because one or more lines are too long
After Width: | Height: | Size: 38 KiB |
Binary file not shown.
Binary file not shown.
@ -0,0 +1,19 @@
|
||||
<!doctype html>
|
||||
<html lang="">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width,initial-scale=1">
|
||||
<link rel="icon" href="/static/favicon.ico">
|
||||
<title>front</title>
|
||||
<script defer="defer" src="/static/js/chunk-vendors.0bcf2d54.js"></script>
|
||||
<script defer="defer" src="/static/js/app.8637dce5.js"></script>
|
||||
<link href="/static/css/chunk-vendors.10dd4e95.css" rel="stylesheet">
|
||||
<link href="/static/css/app.34ccc13b.css" rel="stylesheet">
|
||||
</head>
|
||||
<body>
|
||||
<noscript><strong>We're sorry but front doesn't work properly without JavaScript enabled. Please enable it to
|
||||
continue.</strong></noscript>
|
||||
<div id="app"></div>
|
||||
</body>
|
||||
</html>
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Binary file not shown.
@ -1,3 +1,16 @@
|
||||
from django.contrib import admin
|
||||
|
||||
from teacher.models import Teacher
|
||||
|
||||
|
||||
# Register your models here.
|
||||
|
||||
|
||||
class TeacherAdmin(admin.ModelAdmin):
|
||||
list_display = ("username", "password", "name", "sex", "title", "education", "dept")
|
||||
list_per_page = 5
|
||||
list_filter = ("sex", "title", "education", "dept")
|
||||
search_fields = ("name", "sex", "title", "education", "dept")
|
||||
|
||||
|
||||
admin.site.register(Teacher, TeacherAdmin)
|
Loading…
Reference in new issue