Add filter to export
This commit is contained in:
parent
5af06069e8
commit
102b341920
|
|
@ -1,6 +1,7 @@
|
||||||
from django.core.management import BaseCommand
|
from django.core.management import BaseCommand
|
||||||
|
|
||||||
from basicknowledge.models import BasicKnowledge
|
from basicknowledge.models import BasicKnowledge
|
||||||
|
from datetime import date
|
||||||
|
|
||||||
actions = {
|
actions = {
|
||||||
'text_block': lambda c: print(c.value.get('text')),
|
'text_block': lambda c: print(c.value.get('text')),
|
||||||
|
|
@ -20,7 +21,7 @@ class Command(BaseCommand):
|
||||||
def handle(self, *args, **options):
|
def handle(self, *args, **options):
|
||||||
# todo: only published after X: Page.last_published_at > X
|
# todo: only published after X: Page.last_published_at > X
|
||||||
print('<html><head></head><body>')
|
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>')
|
print(f'<h1>{i.title}</h1>')
|
||||||
for c in i.contents:
|
for c in i.contents:
|
||||||
action = actions.get(c.block_type, lambda c: print(f'==={c.block_type}==='))
|
action = actions.get(c.block_type, lambda c: print(f'==={c.block_type}==='))
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue