def post(self, request): user = self.request.user if not user.id: return Response(None, status=401) data = json.loads(request.body) if not (data.get('worksheet_uuid', None) and data.get('bundle_uuid', None)): return Response("Must have worksheet uuid and bundle uuid", status=status.HTTP_400_BAD_REQUEST) logger.debug("WorksheetAdd: user=%s; name=%s", user.id, data['worksheet_uuid']) service = BundleService(self.request.user) try: data = service.add_worksheet_item(data['worksheet_uuid'], data['bundle_uuid']) return Response({ 'success': True, 'data': data }) except Exception as e: tb = traceback.format_exc() log_exception(self, e, tb) return Response({"error": smart_str(e)}, status=500)
def post(self, request): user = self.request.user if not user.id: return Response(None, status=401) data = json.loads(request.body) if not (data.get('worksheet_uuid', None) and data.get('bundle_uuid', None)): return Response("Must have worksheet uuid and bundle uuid", status=status.HTTP_400_BAD_REQUEST) logger.debug("WorksheetAdd: user=%s; name=%s", user.id, data['worksheet_uuid']) service = BundleService(self.request.user) try: data = service.add_worksheet_item(data['worksheet_uuid'], data['bundle_uuid']) return Response({ 'success': True, 'data': data }) except Exception as e: tb = traceback.format_exc() log_exception(self, e, tb) return Response({"error": smart_str(e)}, status=500)