/
lesbeg
/
django-script-consent
Обзор
Документация
Войти
/
lesbeg
/
django-script-consent
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
2
CI/CD
Аналитика
Безопасность
master
script_consent/context_processors.py
31 строка
1 KB
Anton Trapeznikov
Release 0.2.0
11 авг 2026, 17:40
11 авг 2026, 17:40
5e335fc
Код
Авторство
О чём код?
from script_consent import consent from script_consent.cache import get_runtime_state def script_consent(request): """ Template context: - show_consent_banner / banner shell fields - consent_scripts_head / body_start / body_end - current_consent - script_consent_scripts_hash """ state = consent.get_valid_consent(request) ctx = consent.banner_template_context(request, consent=state) runtime = get_runtime_state() ctx.update( { "current_consent": state, "consent_scripts_head": consent.scripts_for_placement( request, "head", consent=state ), "consent_scripts_body_start": consent.scripts_for_placement( request, "body_start", consent=state ), "consent_scripts_body_end": consent.scripts_for_placement( request, "body_end", consent=state ), "script_consent_scripts_hash": runtime["scripts_hash"], } ) return ctx