def get(self, request, project_id): """ :return: :rtype: JsonResponse """ ag = request.user.agave_oauth.client project = Project.from_uuid(agave_client=ag, uuid=project_id) return JsonResponse(project, encoder=AgaveJSONEncoder, safe=False)
def delete(self, request, project_id): if request.is_ajax(): post_data = json.loads(request.body) else: post_data = request.POST.copy() ag = get_service_account_client() project = Project.from_uuid(agave_client=ag, uuid=project_id) project.remove_collaborator(post_data.get('username')) tasks.check_project_files_meta_pems(project.uuid) return JsonResponse({'status': 'ok'})
def post(self, request, project_id): """ :param request: :return: """ ag = get_service_account_client() if request.is_ajax(): post_data = json.loads(request.body) else: post_data = request.POST.copy() # save Project (metadata) p = Project.from_uuid(ag, project_id) p.title = post_data.get('title') new_pi = post_data.get('pi', None) if p.pi != new_pi: p.pi = new_pi p.add_collaborator(new_pi) p.save() return JsonResponse(p, encoder=AgaveJSONEncoder, safe=False)