diff --git a/app/video/management/commands/load_titles.py b/app/video/management/commands/load_titles.py index b79088b..5a12f07 100644 --- a/app/video/management/commands/load_titles.py +++ b/app/video/management/commands/load_titles.py @@ -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()