From 0c6a11701afcab5d679e87f70c05fe928580c3be Mon Sep 17 00:00:00 2001 From: Raphael Odini Date: Mon, 20 Nov 2023 15:17:12 +0100 Subject: [PATCH] Fix siae on certain pages. ref #820 --- lemarche/utils/tracker.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lemarche/utils/tracker.py b/lemarche/utils/tracker.py index d29883c1b..94381be31 100644 --- a/lemarche/utils/tracker.py +++ b/lemarche/utils/tracker.py @@ -17,6 +17,7 @@ from django.urls import reverse from django.utils import timezone +from lemarche.siaes.models import Siae from lemarche.stats.models import Tracker from lemarche.users.models import User @@ -152,6 +153,8 @@ def track_page(self, page, request: HttpRequest, response: HttpResponse): def extract_user_info(self, request: HttpRequest, context_data: dict): user: User = request.user siae = context_data.get("siae") + if not siae and context_data.get("object") and type(context_data.get("object")) is Siae: + siae = context_data.get("object") return { "user_id": user.id if user.is_authenticated else None, "user_kind": user.kind if user.is_authenticated else "",