Add slugs argument to export instruments command
This commit is contained in:
parent
f071e85863
commit
ebc4ca50ae
|
|
@ -18,13 +18,15 @@ actions = {
|
|||
|
||||
|
||||
class Command(BaseCommand):
|
||||
def add_arguments(self, parser):
|
||||
parser.add_argument('--slugs', nargs='+', type=str)
|
||||
|
||||
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().filter(last_published_at__gt=date(2022, 4, 7)):
|
||||
for i in BasicKnowledge.objects.live().filter(slug__in=options['slugs']):
|
||||
print(f'<h1>{i.title}</h1>')
|
||||
for c in i.contents:
|
||||
action = actions.get(c.block_type, lambda c: print(f'==={c.block_type}==='))
|
||||
action(c)
|
||||
print('</body></html>')
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue