def UpdateZoomMeeting(request, pk): meeting = Zoom.objects.get(id=pk) module = Module.objects.get(id=meeting.module.id) serializer = ZoomSerializer(instance=meeting, data=request.data) module_serializer = ModuleSerializer(instance=module, data=request.data) if module_serializer.is_valid(): module_serializer.save(is_meeting=True) if serializer.is_valid(): serializer.save() return Response(serializer.data)
def CreateZoomModule(request, pk): course = Course.objects.get(id=pk) if course.author.user.id == request.user.id: module = Module(course=course) if request.method == "POST": serializer = ModuleSerializer(module, data=request.data) if serializer.is_valid(): serializer.save(is_meeting=True) return Response(serializer.data) return Response(serializer.errors, status=500) return Response({"message": "you're not authorized"}, status=403)
def UpdateModule(request, pk): module = Module.objects.get(id=pk) serializer = ModuleSerializer(instance=module, data=request.data) if serializer.is_valid(): serializer.save() return Response(serializer.data)