From: Frédéric Péters Date: Thu, 11 Jun 2020 09:25:15 +0000 (+0200) Subject: map item to topiks using pages X-Git-Tag: v2021~27 X-Git-Url: https://git.0d.be/?p=django-panik-combo.git;a=commitdiff_plain;h=e8bd745d82f2f191fe5269209414385ea3ab4700;ds=sidebyside map item to topiks using pages --- diff --git a/panikombo/management/commands/map-item-topik.py b/panikombo/management/commands/map-item-topik.py index 2799499..61b765c 100644 --- a/panikombo/management/commands/map-item-topik.py +++ b/panikombo/management/commands/map-item-topik.py @@ -2,19 +2,20 @@ from django.core.management.base import BaseCommand, CommandError from emissions.models import NewsItem, Episode -from combo.data.models import CellBase -from panikombo.models import Topik, ItemTopik +from combo.data.models import Page, CellBase +from panikombo.models import ItemTopik + class Command(BaseCommand): def handle(self, *args, **kwargs): remaining_item_topik = set(ItemTopik.objects.all()) - for topik in Topik.objects.all(): - cells = CellBase.get_cells(page=topik.page) + for topik_page in Page.objects.exclude(picture__isnull=True): + cells = CellBase.get_cells(page=topik_page) for cell in cells: if not hasattr(cell, 'get_included_items'): continue for item in cell.get_included_items(): - kwargs = {'topik': topik} + kwargs = {'page': topik_page} if isinstance(item, NewsItem): kwargs['newsitem'] = item elif isinstance(item, Episode):