File tree Expand file tree Collapse file tree 1 file changed +9
-2
lines changed
Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -1222,7 +1222,7 @@ def _add(self):
12221222 item = self .datamodel .obj ()
12231223
12241224 try :
1225- form . populate_obj ( item )
1225+ self . populate_item_from_form ( form , item , True )
12261226 self .pre_add (item )
12271227 except Exception as e :
12281228 flash (str (e ), "danger" )
@@ -1266,7 +1266,7 @@ def _edit(self, pk):
12661266 self .process_form (form , False )
12671267
12681268 try :
1269- form . populate_obj ( item )
1269+ self . populate_item_from_form ( form , item , False )
12701270 self .pre_update (item )
12711271 except Exception as e :
12721272 flash (str (e ), "danger" )
@@ -1380,6 +1380,13 @@ def is_get_mutation_allowed(self) -> bool:
13801380 request .method == "GET" and self .appbuilder .app .extensions .get ("csrf" )
13811381 )
13821382
1383+ def populate_item_from_form (self , form , item , is_created ):
1384+ """
1385+ Populate the properties of the item to be created or updated based
1386+ on the content of the form.
1387+ """
1388+ form .populate_obj (item )
1389+
13831390 def prefill_form (self , form , pk ):
13841391 """
13851392 Override this, will be called only if the current action is rendering
You can’t perform that action at this time.
0 commit comments