Add filter to export

This commit is contained in:
Ramon Wenger 2022-05-23 12:41:18 +02:00
parent 5af06069e8
commit 102b341920
1 changed files with 2 additions and 1 deletions

View File

@ -1,6 +1,7 @@
from django.core.management import BaseCommand
from basicknowledge.models import BasicKnowledge
from datetime import date
actions = {
'text_block': lambda c: print(c.value.get('text')),
@ -20,7 +21,7 @@ class Command(BaseCommand):
def handle(self, *args, **options):
# todo: only published after X: Page.last_published_at > X
print('<html><head></head><body>')
for i in BasicKnowledge.objects.live():
for i in BasicKnowledge.objects.live().filter(last_published_at__gt=date(2022, 4, 7)):
print(f'<h1>{i.title}</h1>')
for c in i.contents:
action = actions.get(c.block_type, lambda c: print(f'==={c.block_type}==='))