比赛
All checks were successful
Deploy to Server / deploy (push) Successful in 36s

This commit is contained in:
jeremygan2021
2026-03-10 13:32:04 +08:00
parent 3ada996915
commit af763b1bee
7 changed files with 447 additions and 31 deletions

View File

@@ -82,6 +82,17 @@ class CompetitionViewSet(viewsets.ReadOnlyModelViewSet):
except CompetitionEnrollment.DoesNotExist:
return Response({"detail": "未报名"}, status=status.HTTP_404_NOT_FOUND)
@action(detail=False, methods=['get'])
def my_enrollments(self, request):
"""
获取我的所有报名信息
"""
user = get_current_wechat_user(request)
if not user:
return Response([])
enrollments = CompetitionEnrollment.objects.filter(user=user)
return Response(CompetitionEnrollmentSerializer(enrollments, many=True).data)
class ProjectViewSet(viewsets.ModelViewSet):
"""