use partial updates for cards (#82715)
gitea/publik-imio-industrialisation/pipeline/head This commit looks good
Details
gitea/publik-imio-industrialisation/pipeline/head This commit looks good
Details
This commit is contained in:
parent
2a466becfb
commit
a054970ec3
|
@ -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')):
|
||||
|
|
Loading…
Reference in New Issue