Příkaz na generování náhledů čísel
This commit is contained in:
parent
556f54b2e1
commit
1e5af36ec7
1 changed files with 18 additions and 0 deletions
18
seminar/management/commands/generate_thumbnails.py
Normal file
18
seminar/management/commands/generate_thumbnails.py
Normal file
|
@ -0,0 +1,18 @@
|
|||
from django.core.management.base import BaseCommand
|
||||
|
||||
from seminar.models import Cislo
|
||||
|
||||
from subprocess import CalledProcessError
|
||||
import logging
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
class Command(BaseCommand):
|
||||
def handle(self, *args, **options):
|
||||
for c in Cislo.objects.all():
|
||||
try:
|
||||
c.vygeneruj_nahled()
|
||||
except CalledProcessError:
|
||||
logger.warning(f"Číslo {c} nezvládlo vygenerovat náhled titulky!")
|
||||
pass
|
||||
|
Loading…
Reference in a new issue