From bc123a885e3766e1b6c9fa36b1aee0d9020ab69f Mon Sep 17 00:00:00 2001 From: j Date: Fri, 8 Oct 2021 17:26:24 +0100 Subject: [PATCH] update poster inline --- pandora/item/models.py | 7 +++++-- pandora/item/views.py | 4 ++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/pandora/item/models.py b/pandora/item/models.py index 99f062b91..a5f44aca3 100644 --- a/pandora/item/models.py +++ b/pandora/item/models.py @@ -240,7 +240,7 @@ class Item(models.Model): return True return False - def edit(self, data): + def edit(self, data, is_task=False): data = data.copy() # FIXME: how to map the keys to the right place to write them to? if 'id' in data: @@ -296,7 +296,10 @@ class Item(models.Model): self.data[key] = ox.escape_html(data[key]) p = self.save() if not settings.USE_IMDB and list(filter(lambda k: k in self.poster_keys, data)): - p = tasks.update_poster.delay(self.public_id) + if is_task: + tasks.update_poster(self.public_id) + else: + p = tasks.update_poster.delay(self.public_id) return p def update_external(self): diff --git a/pandora/item/views.py b/pandora/item/views.py index 7eff652af..a84a0720b 100644 --- a/pandora/item/views.py +++ b/pandora/item/views.py @@ -558,8 +558,8 @@ def edit_item(user, item, data, is_task=False): user_groups = set([g.name for g in user.groups.all()]) other_groups = list(groups - user_groups) data['groups'] = [g for g in data['groups'] if g in user_groups] + other_groups - r = item.edit(data) - if r and not is_task: + r = item.edit(data, is_task=is_tras) + if r: r.wait() if update_clips: tasks.update_clips.delay(item.public_id)