diff --git a/flood_adapt/dbs_classes/dbs_template.py b/flood_adapt/dbs_classes/dbs_template.py index 956240610..a896ac99d 100644 --- a/flood_adapt/dbs_classes/dbs_template.py +++ b/flood_adapt/dbs_classes/dbs_template.py @@ -100,6 +100,9 @@ def copy(self, old_name: str, new_name: str, new_description: str): copy_object.attrs.name = new_name copy_object.attrs.description = new_description + # After changing the name and description, receate the model to re-trigger the validators + copy_object.attrs = type(copy_object.attrs)(**copy_object.attrs.dict()) + # Then a save. Checking whether the name is already in use is done in the save function self.save(copy_object)