Skip to content

Commit c4b5e8f

Browse files
committed
Ability to only create twitter cards for missing systems
1 parent c5e1f7a commit c4b5e8f

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

dbdb/core/management/commands/create_twitter_cards.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ class Command(BaseCommand):
1717

1818
def add_arguments(self, parser):
1919
parser.add_argument('--system', type=str)
20+
parser.add_argument('--missing', action='store_true')
2021
return
2122

2223
def handle(self, *args, **options):
@@ -34,8 +35,9 @@ def handle(self, *args, **options):
3435

3536
for ver in versions:
3637
card_img = os.path.join(settings.TWITTER_CARD_ROOT, ver.get_twitter_card_image())
37-
self.stdout.write("%s -> %s" % (ver.system.name, card_img))
38+
if options['missing'] and os.path.exists(card_img): continue
3839
ver.create_twitter_card()
40+
self.stdout.write("%s -> %s" % (ver.system.name, card_img))
3941

4042
# FOR
4143
return

0 commit comments

Comments
 (0)