remove unused items
This commit is contained in:
parent
af1d00a0b2
commit
8eedc76d4a
1 changed files with 3 additions and 0 deletions
|
@ -57,6 +57,7 @@ class Command(BaseCommand):
|
||||||
item['summary'] = ''
|
item['summary'] = ''
|
||||||
folders[item['folder']]['items'].append(item)
|
folders[item['folder']]['items'].append(item)
|
||||||
|
|
||||||
|
slugs = []
|
||||||
for item in folders.values():
|
for item in folders.values():
|
||||||
slug = escape_slug(item['title'].split(' / ')[0])
|
slug = escape_slug(item['title'].split(' / ')[0])
|
||||||
f, c = models.Film.objects.get_or_create(slug=slug)
|
f, c = models.Film.objects.get_or_create(slug=slug)
|
||||||
|
@ -68,3 +69,5 @@ class Command(BaseCommand):
|
||||||
if c:
|
if c:
|
||||||
f.public = True
|
f.public = True
|
||||||
f.save()
|
f.save()
|
||||||
|
slugs.append(slug)
|
||||||
|
models.Film.objects.exclude(slug__in=slugs).delete()
|
||||||
|
|
Loading…
Reference in a new issue