custom django command for promo logos

This commit is contained in:
Kenneth SOARES 2025-04-09 17:33:34 +02:00
parent 11efa4fca2
commit c0419d0805

View File

@ -0,0 +1,14 @@
from django.core.management.base import BaseCommand
from PIL import Image
class Command(BaseCommand):
def add_arguments(self, parser):
parser.add_argument("--numero", type=int)
parser.add_argument("--path", type=str)
def handle(self, *args, **options):
if options["path"] and options["numero"]:
im = Image.open(options["path"]).resize((120, 120)).convert("RGBA")
im.save(f"core/static/core/img/promo_{options['numero']}.png", format="PNG")
im.close()