You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
padelclub_backend/tournaments/utils/extensions.py

16 lines
432 B

import uuid
def format_seconds(seconds):
hours = int(seconds / 3600)
minutes = int((seconds % 3600) / 60)
return f"{hours:02d}h{minutes:02d}min"
def plural_format(label, count):
if count < 2:
return f"{count} {label}"
else:
return f"{count} {label}s"
def create_random_filename(base_name, extension):
random_string = str(uuid.uuid4())
return f"{base_name}_{random_string}.{extension}"