Commit 7d4d6446 authored by Matheus Miranda's avatar Matheus Miranda
Browse files

Merge branch 'issue_77_allow_groups_editing' into 'develop'

New endpoint to list groups

See merge request !31
parents f541597a 7fad3a23
......@@ -12,12 +12,29 @@ from .serializers import (CourseSerializer, BasicCourseProfessorSerializer,
ProfessorMessageSerializer, ProfessorMessageReadSerializer,
from courses.workspaces.serializers import CourseGroupSerializer
from .permissions import (
class CourseGroupViewSet(viewsets.ModelViewSet):
model = Course
queryset = Course.objects.all()
serializer_class = CourseGroupSerializer
def get_queryset(self):
queryset = super(CourseGroupViewSet, self).get_queryset()
course = self.request.query_params.get('id', None)
if course:
queryset = queryset.filter(groups__id = course)
return queryset
class CourseViewSet(viewsets.ModelViewSet):
......@@ -86,3 +86,14 @@ class CourseGroupSerializer(serializers.ModelSerializer):
class Meta:
model = Course
fields = ('slug', 'name', 'groups')
def update(self, instance, validated_data):
data = self.context.get('request').data
course = super().update(instance, validated_data)
if 'groups' in data:
for g in data['groups']:
return course
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment