use partial updates for cards (#82715)
gitea/publik-imio-industrialisation/pipeline/head This commit looks good Details

This commit is contained in:
Frédéric Péters 2023-10-25 13:12:58 +02:00
parent 2a466becfb
commit a054970ec3
1 changed files with 12 additions and 3 deletions

View File

@ -182,9 +182,18 @@ class Cmd(Command):
except Exception as e:
raise Exception('failed to load existing carddef %r' % filename) from e
else:
# replace
carddef.id = existing_carddef.id
carddef.store(comment='Indus Update')
# partial update
for attribute in (
'fields',
'digest_template',
'lateral_template',
'submission_lateral_template',
'geolocations',
):
if hasattr(carddef, attribute):
setattr(existing_carddef, attribute, getattr(carddef, attribute))
existing_carddef.store(comment='Indus Update')
def import_formdefs(self):
if not os.path.exists(os.path.join(self.directory, 'forms')):