kylebjordahl Posted September 21, 2017 Report Share Posted September 21, 2017 Hey everyone, I'm wondering if there is an easy way to duplicate entities via the python API? My aim is to allow non-programmer team members define a template project and then duplicate it into a newly created project. My plan is to recurse through the descendants tree, but there doesn't seem to be a nice way to duplicate an entity while leaving the immutable stuff out (I've tried creating the project with the template project supplied as the 'data' value in the create method, to no avail). Ideally, I would like to include all the aspects of the project, including the project specific user groups, task assignments, etc. Link to comment Share on other sites More sharing options...
Mattias Lagergren Posted September 22, 2017 Report Share Posted September 22, 2017 Hi Kyle, I'm afraid there is no "clone" entity - included nested data - feature available in the API. You would not to traverse the dependency tree your-self. Once you have done this you can add it as an entity factor plugin so that you can call project = project.clone_project(...). Link to comment Share on other sites More sharing options...
kylebjordahl Posted September 23, 2017 Author Report Share Posted September 23, 2017 Hey Mattais, I figured this was the case, so then I run into a slightly different problem: is there a way to tell which data members of an entity are immutable? I was hoping to iterate through the dictionary for each entity and create a new dict which could be passed as the 'data' argument for the create function, but need to be sure that I don't pass any immutable values, since the create will fail. Alternately, I suppose it could be done by creating the entity first, then attempting to assign values to the new entity while iterating through the old one, and catching the exceptions along the way. Thanks Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.