Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix contact insertion #3305

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions integreat_cms/cms/views/utils/contact_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
from django.core.exceptions import PermissionDenied
from django.http import HttpResponse, JsonResponse
from django.shortcuts import get_object_or_404, render
from django.urls import reverse
from django.views.decorators.http import require_POST

from ...decorators import permission_required
Expand Down Expand Up @@ -37,8 +38,6 @@ def search_contact_ajax(
:raises ~django.core.exceptions.PermissionDenied: If the user has no permission to the object type
:return: Json object containing all matching elements, of shape {title: str, url: str, type: str}
"""
# pylint: disable=unused-argument

body = json.loads(request.body.decode("utf-8"))
if (query := body["query_string"]) is None:
return JsonResponse({"data": []})
Expand All @@ -54,7 +53,10 @@ def search_contact_ajax(
{
"data": [
{
"url": result.full_url,
"url": reverse(
"get_contact",
kwargs={"contact_id": result.id, "region_slug": region_slug},
),
"name": result.get_repr_short,
}
for result in results
Expand Down
Loading