1
0
Fork 0
mirror of https://codeberg.org/Mo8it/AdvLabDB.git synced 2024-09-19 18:31:16 +00:00

Check returned bool from customUpdateModel

This commit is contained in:
Mo 2022-06-30 19:43:20 +02:00
parent 34c9b3318d
commit 4d9a72431d

View file

@ -159,11 +159,18 @@ class CustomModelView(ModelView):
return model
def customUpdateModel(self, form, model):
"""
Retrun True if something changed during update, False otherwise.
"""
form.populate_obj(model)
# No way to know if something changed. Therefore, return True anyway.
return True
def update_model(self, form, model):
try:
self.customUpdateModel(form, model)
if self.customUpdateModel(form, model) is False:
# Nothing changed
return True
self.on_model_change(form, model, False)
self.session.commit()