Skip to content

Commit

Permalink
Fix siae on certain pages. ref #820
Browse files Browse the repository at this point in the history
  • Loading branch information
raphodn committed Nov 20, 2023
1 parent b9cbbbd commit 0c6a117
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions lemarche/utils/tracker.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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 "",
Expand Down

0 comments on commit 0c6a117

Please sign in to comment.