From 11511e777fc204a48f2db7eaf947b581f985a5a6 Mon Sep 17 00:00:00 2001 From: Daley Adrichem Date: Tue, 9 Apr 2024 14:26:39 +0200 Subject: [PATCH] Add rerunning validators --- flood_adapt/dbs_classes/dbs_template.py | 3 +++ 1 file changed, 3 insertions(+) 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)