mirror of
https://github.com/ae-utbm/sith.git
synced 2025-08-15 21:49:57 +00:00
Compare commits
3 Commits
promo_add_
...
dependabot
Author | SHA1 | Date | |
---|---|---|---|
|
22b3df4188 | ||
|
080dd7756d | ||
ae5165af19
|
@@ -1,41 +0,0 @@
|
|||||||
import pathlib
|
|
||||||
|
|
||||||
from django.apps import apps
|
|
||||||
from django.core.management.base import BaseCommand
|
|
||||||
from PIL import Image, UnidentifiedImageError
|
|
||||||
|
|
||||||
|
|
||||||
class Command(BaseCommand):
|
|
||||||
def add_arguments(self, parser):
|
|
||||||
parser.add_argument("number", type=int)
|
|
||||||
parser.add_argument("path", type=pathlib.Path)
|
|
||||||
parser.add_argument("-f", "--force", action="store_true")
|
|
||||||
|
|
||||||
def handle(self, number: int, path: pathlib.Path, force: int, *args, **options):
|
|
||||||
if not path.exists() or path.is_dir():
|
|
||||||
self.stderr.write(f"{path} is not a file or does not exist")
|
|
||||||
return
|
|
||||||
|
|
||||||
dest_path = (
|
|
||||||
pathlib.Path(apps.get_app_config("core").path)
|
|
||||||
/ "static"
|
|
||||||
/ "core"
|
|
||||||
/ "img"
|
|
||||||
/ f"promo_{number}.png"
|
|
||||||
)
|
|
||||||
|
|
||||||
if dest_path.exists() and not force:
|
|
||||||
over = input("File already exists, do you want to overwrite it? (y/N):")
|
|
||||||
if over.lower() != "y":
|
|
||||||
self.stdout.write("exiting")
|
|
||||||
return
|
|
||||||
try:
|
|
||||||
im = Image.open(path)
|
|
||||||
im.resize((120, 120), resample=Image.Resampling.LANCZOS).save(
|
|
||||||
dest_path, format="PNG"
|
|
||||||
)
|
|
||||||
self.stdout.write(
|
|
||||||
f"Promo logo moved and resized successfully at {dest_path}"
|
|
||||||
)
|
|
||||||
except UnidentifiedImageError:
|
|
||||||
self.stderr.write("image cannot be opened and identified.")
|
|
@@ -2,6 +2,10 @@
|
|||||||
@import "devices";
|
@import "devices";
|
||||||
|
|
||||||
footer.bottom-links {
|
footer.bottom-links {
|
||||||
|
>section>a {
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
@media (max-width: $small-devices) {
|
@media (max-width: $small-devices) {
|
||||||
margin-top: 0.6em;
|
margin-top: 0.6em;
|
||||||
padding: 1.25em;
|
padding: 1.25em;
|
||||||
|
@@ -12,15 +12,6 @@ nouveau logo d'une promo. C'est un processus manuel.
|
|||||||
de faire cette opération manuellement, ça prend quelques
|
de faire cette opération manuellement, ça prend quelques
|
||||||
minutes et on est certain de la qualité à la fin.
|
minutes et on est certain de la qualité à la fin.
|
||||||
|
|
||||||
### avec une commande django
|
|
||||||
```bash
|
|
||||||
./manage.py add_promo_logo numero_de_promo chemin_dacces_du_logo
|
|
||||||
```
|
|
||||||
options:
|
|
||||||
|
|
||||||
* `--force/-f` pour automatiquement écraser les logos de promo avec le même nom.
|
|
||||||
|
|
||||||
### manuellement
|
|
||||||
Les logos de promo sont à manuellement ajouter dans le projet.
|
Les logos de promo sont à manuellement ajouter dans le projet.
|
||||||
Ils se situent dans le dossier `core/static/core/img/`.
|
Ils se situent dans le dossier `core/static/core/img/`.
|
||||||
|
|
||||||
|
@@ -43,7 +43,7 @@ dependencies = [
|
|||||||
"tomli<3.0.0,>=2.2.1",
|
"tomli<3.0.0,>=2.2.1",
|
||||||
"django-honeypot>=1.3.0,<2",
|
"django-honeypot>=1.3.0,<2",
|
||||||
"pydantic-extra-types<3.0.0,>=2.10.3",
|
"pydantic-extra-types<3.0.0,>=2.10.3",
|
||||||
"ical>=10.0.3,<11",
|
"ical>=10.0.3,<12",
|
||||||
"redis[hiredis]<6.0.0,>=5.3.0",
|
"redis[hiredis]<6.0.0,>=5.3.0",
|
||||||
"environs[django]<15.0.0,>=14.1.1",
|
"environs[django]<15.0.0,>=14.1.1",
|
||||||
"requests>=2.32.3",
|
"requests>=2.32.3",
|
||||||
|
Reference in New Issue
Block a user