-
- Downloads
There was a problem fetching the pipeline summary.
Reviewer can activate/deactivate student access
The reviewer has the option to activate and deactivate all students access via the web interface in the student overview. The corresponding endpoints are additional list routes on the student viewset. Tests are in test_reviewer_viewset.py
parent
5ba3ed77
No related branches found
No related tags found
Pipeline #
Showing
- core/serializers/__init__.py 1 addition, 1 deletioncore/serializers/__init__.py
- core/serializers/feedback.py 0 additions, 1 deletioncore/serializers/feedback.py
- core/serializers/student.py 3 additions, 1 deletioncore/serializers/student.py
- core/tests/test_student_reviewer_viewset.py 26 additions, 6 deletionscore/tests/test_student_reviewer_viewset.py
- core/views/common_views.py 18 additions, 2 deletionscore/views/common_views.py
- frontend/src/api.js 8 additions, 0 deletionsfrontend/src/api.js
- frontend/src/components/student_list/StudentList.vue 3 additions, 0 deletionsfrontend/src/components/student_list/StudentList.vue
- frontend/src/components/student_list/StudentListMenu.vue 78 additions, 0 deletionsfrontend/src/components/student_list/StudentListMenu.vue
... | ... | @@ -5,8 +5,8 @@ import logging |
from django.conf import settings | ||
from django.db.models import Avg | ||
from rest_framework import generics, mixins, viewsets | ||
from rest_framework.decorators import api_view | ||
from rest_framework import generics, mixins, viewsets, status | ||
from rest_framework.decorators import api_view, list_route | ||
from rest_framework.response import Response | ||
from core import models | ||
... | ... | @@ -63,6 +63,22 @@ class StudentReviewerApiViewSet(viewsets.ReadOnlyModelViewSet): |
.all() | ||
serializer_class = StudentInfoSerializerForListView | ||
def _set_students_active(self, active): | ||
|
||
for student in self.get_queryset(): | ||
user = student.user | ||
user.is_active = active | ||
user.save() | ||
@list_route(methods=['post']) | ||
def deactivate(self, request): | ||
self._set_students_active(False) | ||
return Response(status=status.HTTP_200_OK) | ||
@list_route(methods=['post']) | ||
def activate(self, request): | ||
self._set_students_active(True) | ||
return Response(status=status.HTTP_200_OK) | ||
class ExamApiViewSet(viewsets.ReadOnlyModelViewSet): | ||
""" Gets a list of an individual exam by Id if provided """ | ||
... | ... |