diff --git a/tailbone/views/master.py b/tailbone/views/master.py index 611e59f5..cb47a25e 100644 --- a/tailbone/views/master.py +++ b/tailbone/views/master.py @@ -413,6 +413,11 @@ class MasterView(View): return self.merge_coalesce_fields return [] + def get_merge_additive_fields(self): + if hasattr(self, 'merge_additive_fields'): + return self.merge_additive_fields + return [] + def merge(self): """ Preview and execute a merge of two records. @@ -463,6 +468,11 @@ class MasterView(View): for field in self.get_merge_coalesce_fields(): if remove[field] and not keep[field]: result[field] = remove[field] + for field in self.get_merge_additive_fields(): + if isinstance(keep[field], (list, tuple)): + result[field] = sorted(set(remove[field] + keep[field])) + else: + result[field] = remove[field] + keep[field] return result def merge_objects(self, removing, keeping):