def delete_label(request, project_id, label_id): project = ProjectModel.get_by_id(long(project_id)) if project is None: raise Http404 if request.user.permission != UserPermission.root and\ request.user.key().id() not in project.root_ids: raise Http403 label = LabelModel.get_by_id(long(label_id)) label.delete() return HttpResponse()
def update_label(request, project_id, label_id): form = LabelForm(**json.loads(request.body)) if not form.validate(): raise Http400 project = ProjectModel.get_by_id(long(project_id)) if project is None: raise Http404 if request.user.permission != UserPermission.root and\ request.user.key().id() not in project.root_ids: raise Http403 label = LabelModel.get_by_id(long(label_id)) label.title = form.title.data label.put() return JsonResponse(label)