feat: update personal stats and cms change reuqest method

This commit is contained in:
2026-06-12 11:11:48 +08:00
parent f2dcf3d490
commit 2fab2be0a1
12 changed files with 546 additions and 43 deletions
+6 -2
View File
@@ -16,6 +16,10 @@ def rel_detail(pk):
return f'/api/cms/teacher-student-relations/{pk}/'
def rel_disable(pk):
return f'/api/cms/teacher-student-relations/{pk}/disable/' # 停用:POST(原 DELETE /{id}/
def make_xlsx(headers, rows):
wb = Workbook(); ws = wb.active
ws.append(headers)
@@ -69,8 +73,8 @@ class CmsRelationTest(CacheTestCase):
def test_soft_delete(self):
r = TeacherStudentRelation.objects.create(teacher=self.doc, student=self.stu, status=1)
resp = self.client.delete(rel_detail(r.id))
self.assertEqual(resp.status_code, 204, resp.content)
resp = self.client.post(rel_disable(r.id))
self.assertEqual(resp.status_code, 200, resp.content)
self.assertFalse(TeacherStudentRelation.objects.filter(id=r.id).exists())
self.assertTrue(TeacherStudentRelation.all_objects.get(id=r.id).is_deleted)