Create new logos for each competition - codalab/codabench GitHub Wiki
v1.4.1
This intervention is needed when upgrading from a version equal or lower thanIn order to create a "logo icon" for each existing competition
- Shell into django
docker compose exec django bash
python manage.py shell_plus --plain
- Get competitions that don't have logo icons
import io, os
from PIL import Image
from django.core.files.base import ContentFile
comps_no_icon_logo = Competition.objects.filter(logo_icon__isnull=True)
all = Competition.objects.all()
len(Competition.objects.all())
len(comps_no_icon_logo)
- Then run this script
for comp in comps_no_icon_logo:
try:
comp.make_logo_icon()
comp.save()
except Exception as e:
print(f"An error occurred: {e}")
print(comp)