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.
22 lines
636 B
22 lines
636 B
import uuid
|
|
from django.conf import settings
|
|
|
|
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}"
|
|
|
|
def is_not_sqlite_backend():
|
|
return True
|
|
default_db_engine = settings.DATABASES['default']['ENGINE']
|
|
return default_db_engine != 'django.db.backends.sqlite3'
|
|
|