Skip to content

utils

django_spire.theme.utils

Source code in django_spire/theme/utils.py
def get_theme_cookie_name() -> str:
    if not hasattr(settings, 'BASE_DIR'):
        return 'django-spire-theme'

    encoded = str(settings.BASE_DIR).encode()
    identifier = hashlib.md5(encoded, usedforsecurity=False).hexdigest()[:8]
    return f'django-spire-theme-{identifier}'