diff options
author | Étienne Loks <etienne.loks@iggdrasil.net> | 2024-04-09 15:41:20 +0200 |
---|---|---|
committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2024-04-16 16:43:03 +0200 |
commit | f0a0a576b96d0242d47754f4a0f2bff528d1e05d (patch) | |
tree | 37ba36ca8b4b84050e8939873dbd669f44c89365 /ishtar_common/models.py | |
parent | 9d6b5a2c325fab3a017215f2e2bbc596ddbd8798 (diff) | |
download | Ishtar-f0a0a576b96d0242d47754f4a0f2bff528d1e05d.tar.bz2 Ishtar-f0a0a576b96d0242d47754f4a0f2bff528d1e05d.zip |
✨ Document: post importer action - set main image
Diffstat (limited to 'ishtar_common/models.py')
-rw-r--r-- | ishtar_common/models.py | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/ishtar_common/models.py b/ishtar_common/models.py index 14b210ea2..e40c7c54c 100644 --- a/ishtar_common/models.py +++ b/ishtar_common/models.py @@ -4712,6 +4712,16 @@ class Document( ) ) + @post_importer_action + def set_main_image(self, __, value): + """ + Post importer action - set the imported image as a main image for associated "value" items + """ + for item in getattr(self, value).all(): + item.main_image = self + item.no_post_process() + item.save() + def get_related_operation_ids(self): operations = list(self.operations.values_list("id", flat=True).all()) operations += list( |