From 91a7c0cedea79071e5720b091471ff5dc4b11e16 Mon Sep 17 00:00:00 2001 From: j Date: Tue, 23 Jul 2019 17:55:08 +0200 Subject: [PATCH] another place sort is required now --- pandora/archive/tasks.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/pandora/archive/tasks.py b/pandora/archive/tasks.py index 6bb34bb6..2443149a 100644 --- a/pandora/archive/tasks.py +++ b/pandora/archive/tasks.py @@ -209,7 +209,7 @@ def download_media(item_id, url): @task(queue='default') def move_media(data, user): from changelog.models import add_changelog - from item.models import get_item, Item + from item.models import get_item, Item, ItemSort from item.utils import is_imdb_id from annotation.models import Annotation @@ -229,6 +229,11 @@ def move_media(data, user): i = get_item(data, user=user) else: i = get_item({'imdbId': data['public_id']}, user=user) + try: + i.sort + except ItemSort.DoesNotExist: + i.update_sort() + changed = [i.public_id] old_item = None for f in models.File.objects.filter(oshash__in=data['ids']):