def clone(experiment_id): set_experiment(experiment_id=experiment_id) # copy current experiment attributes app_id = current_experiment.app_id name = current_experiment.name + '_clone' description = current_experiment.description instructions = current_experiment.instructions debrief = current_experiment.debrief params = current_experiment.params target_set = current_experiment.target_set # create new experiment object experiment = Experiment(name=name, description=description, instructions=instructions, debrief=debrief, app_id=app_id, params=params, target_set=target_set) experiment.save() # Add experiment to the current project current_project.add_experiment(experiment) return redirect(url_for('experiment.edit', experiment_id=experiment.id))