events: log parsed query string instead of just full path

Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
Jens Langhammer 2021-09-15 20:15:04 +02:00
parent abd9fab41a
commit d4672bfe79
1 changed files with 3 additions and 1 deletions

View File

@ -8,6 +8,7 @@ from uuid import uuid4
from django.conf import settings from django.conf import settings
from django.db import models from django.db import models
from django.http import HttpRequest from django.http import HttpRequest
from django.http.request import QueryDict
from django.utils.timezone import now from django.utils.timezone import now
from django.utils.translation import gettext as _ from django.utils.translation import gettext as _
from requests import RequestException from requests import RequestException
@ -139,8 +140,9 @@ class Event(ExpiringModel):
`user` arguments optionally overrides user from requests.""" `user` arguments optionally overrides user from requests."""
if request: if request:
self.context["http_request"] = { self.context["http_request"] = {
"path": request.get_full_path(), "path": request.path,
"method": request.method, "method": request.method,
"args": QueryDict(request.META.get("QUERY_STRING", "")),
} }
if hasattr(request, "tenant"): if hasattr(request, "tenant"):
tenant: Tenant = request.tenant tenant: Tenant = request.tenant