Compare commits
4 Commits
7b09141c35
...
1e084d20f3
Author | SHA1 | Date |
---|---|---|
lrs | 1e084d20f3 | 1 year ago |
lrs | 005661deef | 1 year ago |
lrs | 2bb816a4ef | 1 year ago |
lrs | 16ff43e0ec | 1 year ago |
@ -0,0 +1,14 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="PublishConfigData" remoteFilesAllowedToDisappearOnAutoupload="false">
|
||||||
|
<serverData>
|
||||||
|
<paths name="root@222.187.226.110:35261">
|
||||||
|
<serverdata>
|
||||||
|
<mappings>
|
||||||
|
<mapping local="$PROJECT_DIR$" web="/" />
|
||||||
|
</mappings>
|
||||||
|
</serverdata>
|
||||||
|
</paths>
|
||||||
|
</serverData>
|
||||||
|
</component>
|
||||||
|
</project>
|
@ -1,4 +1,4 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<project version="4">
|
<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>
|
</project>
|
@ -0,0 +1,14 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="PublishConfigData" remoteFilesAllowedToDisappearOnAutoupload="false">
|
||||||
|
<serverData>
|
||||||
|
<paths name="root@222.187.226.110:35261">
|
||||||
|
<serverdata>
|
||||||
|
<mappings>
|
||||||
|
<mapping local="$PROJECT_DIR$" web="/" />
|
||||||
|
</mappings>
|
||||||
|
</serverdata>
|
||||||
|
</paths>
|
||||||
|
</serverData>
|
||||||
|
</component>
|
||||||
|
</project>
|
@ -1,4 +1,8 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<project version="4">
|
<project version="4">
|
||||||
|
<<<<<<< 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" />
|
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.7 (EduSystemServer)" project-jdk-type="Python SDK" />
|
||||||
|
>>>>>>> 7b09141c358f80dd8877b8665d0d55b629db72aa
|
||||||
</project>
|
</project>
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -0,0 +1,23 @@
|
|||||||
|
# Generated by Django 3.2.13 on 2023-09-07 08:59
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('Eduadmin', '0001_initial'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='admin',
|
||||||
|
name='password',
|
||||||
|
field=models.CharField(blank=True, max_length=128, verbose_name='管理员密码'),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='admin',
|
||||||
|
name='username',
|
||||||
|
field=models.CharField(blank=True, max_length=32, primary_key=True, serialize=False, verbose_name='管理员账号'),
|
||||||
|
),
|
||||||
|
]
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -0,0 +1,53 @@
|
|||||||
|
# Generated by Django 3.2.13 on 2023-09-07 09:16
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('Student', '0001_initial'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='student',
|
||||||
|
name='s_class_name',
|
||||||
|
field=models.CharField(blank=True, max_length=50, verbose_name='班级'),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='student',
|
||||||
|
name='s_grade',
|
||||||
|
field=models.CharField(blank=True, max_length=20, verbose_name='年级'),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='student',
|
||||||
|
name='s_major',
|
||||||
|
field=models.CharField(blank=True, max_length=50, verbose_name='专业名称'),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='student',
|
||||||
|
name='s_name',
|
||||||
|
field=models.CharField(blank=True, max_length=100, verbose_name='姓名'),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='student',
|
||||||
|
name='s_password',
|
||||||
|
field=models.CharField(blank=True, max_length=100, verbose_name='密码'),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='student',
|
||||||
|
name='s_sex',
|
||||||
|
field=models.CharField(blank=True, max_length=4, verbose_name='性别'),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='student',
|
||||||
|
name='s_username',
|
||||||
|
field=models.CharField(blank=True, max_length=30, verbose_name='用户名称'),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='student',
|
||||||
|
name='sid',
|
||||||
|
field=models.AutoField(primary_key=True, serialize=False, verbose_name='学生编号'),
|
||||||
|
),
|
||||||
|
]
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -0,0 +1,23 @@
|
|||||||
|
# Generated by Django 3.2.13 on 2023-09-07 08:59
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('course', '0001_initial'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='course',
|
||||||
|
name='c_name',
|
||||||
|
field=models.CharField(blank=True, max_length=255, verbose_name='课程名称'),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='course',
|
||||||
|
name='c_type',
|
||||||
|
field=models.CharField(blank=True, max_length=128, verbose_name='课程类型'),
|
||||||
|
),
|
||||||
|
]
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -0,0 +1,38 @@
|
|||||||
|
# Generated by Django 3.2.13 on 2023-09-07 08:59
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('teacher', '0001_initial'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='teacher',
|
||||||
|
name='t_dept',
|
||||||
|
field=models.CharField(blank=True, max_length=128, verbose_name='教师所属院系'),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='teacher',
|
||||||
|
name='t_education',
|
||||||
|
field=models.CharField(blank=True, max_length=128, verbose_name='教师学历'),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='teacher',
|
||||||
|
name='t_name',
|
||||||
|
field=models.CharField(blank=True, max_length=255, verbose_name='教师名称'),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='teacher',
|
||||||
|
name='t_sex',
|
||||||
|
field=models.CharField(blank=True, max_length=128, verbose_name='教师性别'),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='teacher',
|
||||||
|
name='t_title',
|
||||||
|
field=models.CharField(blank=True, max_length=128, verbose_name='教师职称'),
|
||||||
|
),
|
||||||
|
]
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -0,0 +1,16 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
# Time : 2023/9/7 10:54
|
||||||
|
# Author : lirunsheng
|
||||||
|
# User : l'r's
|
||||||
|
# Software: PyCharm
|
||||||
|
# File : urls.py
|
||||||
|
|
||||||
|
from django.urls import path
|
||||||
|
|
||||||
|
from .views import *
|
||||||
|
|
||||||
|
urlpatterns = [
|
||||||
|
path("", teacher),
|
||||||
|
path('delete/',delete),
|
||||||
|
path('student/',student_performance_management)
|
||||||
|
]
|
@ -1,3 +1,125 @@
|
|||||||
from django.shortcuts import render
|
from django.shortcuts import render
|
||||||
|
|
||||||
# Create your views here.
|
# Create your views here.
|
||||||
|
|
||||||
|
# Create your views here.
|
||||||
|
from django.http import JsonResponse
|
||||||
|
from .models import Teacher
|
||||||
|
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 Student.models import Student
|
||||||
|
import json
|
||||||
|
@csrf_exempt
|
||||||
|
def teacher(request):
|
||||||
|
if request.method == "POST":
|
||||||
|
teacher_information = Teacher()
|
||||||
|
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)
|
||||||
|
|
||||||
|
elif request.method == "GET":
|
||||||
|
name = request.GET.get('name')
|
||||||
|
sex = request.GET.get('sex')
|
||||||
|
title = request.GET.get('title')
|
||||||
|
education = request.GET.get('education')
|
||||||
|
dept = request.GET.get('dept')
|
||||||
|
data = []
|
||||||
|
if name:
|
||||||
|
filtered = Teacher.objects.filter(name=name)
|
||||||
|
for teacher_x in filtered:
|
||||||
|
data.append(teacher_x.to_dict())
|
||||||
|
elif sex:
|
||||||
|
filtered = Teacher.objects.filter(sex=sex)
|
||||||
|
for teacher_x in filtered:
|
||||||
|
data.append(teacher_x.to_dict())
|
||||||
|
elif title:
|
||||||
|
filtered = Teacher.objects.filter(title=title)
|
||||||
|
for teacher_x in filtered:
|
||||||
|
data.append(teacher_x.to_dict())
|
||||||
|
elif education:
|
||||||
|
filtered = Teacher.objects.filter(education=education)
|
||||||
|
for teacher_x in filtered:
|
||||||
|
data.append(teacher_x.to_dict())
|
||||||
|
elif dept:
|
||||||
|
filtered = Teacher.objects.filter(dept=dept)
|
||||||
|
for teacher_x in filtered:
|
||||||
|
data.append(teacher_x.to_dict())
|
||||||
|
else:
|
||||||
|
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)
|
||||||
|
|
||||||
|
elif request.method == "DELETE":
|
||||||
|
parser = MultiPartParser(request.META, BytesIO(request.body), request.upload_handlers, request.encoding)
|
||||||
|
posdict = parser.parse()
|
||||||
|
print(posdict)
|
||||||
|
tid = int(posdict[0]['tid'])
|
||||||
|
print(tid)
|
||||||
|
try:
|
||||||
|
info = Teacher.objects.filter(tid=tid).get().to_dict()
|
||||||
|
Teacher.objects.filter(tid=tid).delete()
|
||||||
|
response = {"code": 200, "message": "删除成功!", "data": info}
|
||||||
|
return JsonResponse(response)
|
||||||
|
except:
|
||||||
|
response = {"code": 200, "message": "删除失败,未找到老师信息!"}
|
||||||
|
return JsonResponse(response)
|
||||||
|
elif request.method == 'PUT':
|
||||||
|
put = MultiPartParser(request.META, request, request.upload_handlers, request.encoding).parse()
|
||||||
|
# request.PUT = put[0]
|
||||||
|
print(put)
|
||||||
|
tid = put[0]['tid']
|
||||||
|
name = put[0]['name']
|
||||||
|
sex = put[0]['sex']
|
||||||
|
title = put[0]['title']
|
||||||
|
education = put[0]['education']
|
||||||
|
dept = put[0]['dept']
|
||||||
|
Teacher.objects.filter(tid=tid).update(name=name)
|
||||||
|
Teacher.objects.filter(tid=tid).update(sex=sex)
|
||||||
|
Teacher.objects.filter(tid=tid).update(title=title)
|
||||||
|
Teacher.objects.filter(tid=tid).update(education=education)
|
||||||
|
Teacher.objects.filter(tid=tid).update(dept=dept)
|
||||||
|
data = Teacher.objects.filter(tid=tid)[0].to_dict()
|
||||||
|
return JsonResponse({'code': 200, 'msg': 'success','data':data}, safe=False)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
def delete(request):
|
||||||
|
tid = request.GET.get('tid')
|
||||||
|
try:
|
||||||
|
Teacher.objects.filter(tid = tid).delete()
|
||||||
|
return JsonResponse({'code': 200, 'msg': 'success'}, safe=False)
|
||||||
|
except:
|
||||||
|
return JsonResponse({'code': 200, 'msg': '删除失败'}, safe=False)
|
||||||
|
|
||||||
|
@csrf_exempt
|
||||||
|
def teaching_resources(request):
|
||||||
|
pass
|
||||||
|
@csrf_exempt
|
||||||
|
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)
|
||||||
|
else:
|
||||||
|
return JsonResponse({'code': 200, 'msg': '成绩输入有误'}, safe=False)
|
||||||
|
Loading…
Reference in new issue