mirror of
https://github.com/ae-utbm/sith.git
synced 2025-06-17 08:35:20 +00:00
custom django command for promo logos
This commit is contained in:
parent
11efa4fca2
commit
c0419d0805
14
core/management/commands/add_promo_logo.py
Normal file
14
core/management/commands/add_promo_logo.py
Normal 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()
|
Loading…
x
Reference in New Issue
Block a user