remove unused items

This commit is contained in:
j 2021-11-23 17:28:32 +01:00
parent af1d00a0b2
commit 8eedc76d4a

View file

@ -57,6 +57,7 @@ class Command(BaseCommand):
item['summary'] = ''
folders[item['folder']]['items'].append(item)
slugs = []
for item in folders.values():
slug = escape_slug(item['title'].split(' / ')[0])
f, c = models.Film.objects.get_or_create(slug=slug)
@ -68,3 +69,5 @@ class Command(BaseCommand):
if c:
f.public = True
f.save()
slugs.append(slug)
models.Film.objects.exclude(slug__in=slugs).delete()