remove unnecessary imports
[mygpo.git] / mygpo / search / management / commands / build-search-index.py
blob6b25c9f3c244a9b94f541acdae838c71447d5358
1 from django.core.management.base import BaseCommand
2 from mygpo.search.models import SearchEntry
3 from mygpo.api.models import ToplistEntry
5 class Command(BaseCommand):
7 def handle(self, *args, **options):
9 SearchEntry.objects.all().delete()
11 toplist = ToplistEntry.objects.all()
12 for e in toplist:
13 entry = None
14 if e.podcast_group:
15 entry = SearchEntry.from_object(e.podcast_group, e.subscriptions)
17 elif e.podcast:
18 entry = SearchEntry.from_object(e.podcast, e.subscriptions)
20 if entry and entry.text:
21 entry.save()