From 96c79f573a73983403124f06cbc9784e2d6e9512 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20Dlouh=C3=BD?= Date: Wed, 29 Sep 2021 11:07:24 +0200 Subject: [PATCH] fix to enable using UUIDs/non-default PKs --- django_comments_xtd/api/frontend.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/django_comments_xtd/api/frontend.py b/django_comments_xtd/api/frontend.py index 10dffd0a..d77c0b57 100644 --- a/django_comments_xtd/api/frontend.py +++ b/django_comments_xtd/api/frontend.py @@ -61,7 +61,7 @@ def _reverse(*args, **kwargs): form = CommentSecurityForm(obj) ctype = ContentType.objects.get_for_model(obj) queryset = XtdComment.objects.filter(content_type=ctype, - object_pk=obj.pk, + object_pk=obj._get_pk_val(), site__pk=get_current_site_id(request), is_public=True) ctype_slug = "%s-%s" % (ctype.app_label, ctype.model) @@ -86,10 +86,10 @@ def _reverse(*args, **kwargs): "flag_url": _reverse("comments-flag", args=(0,)), "list_url": _reverse('comments-xtd-api-list', kwargs={'content_type': ctype_slug, - 'object_pk': obj.id}), + 'object_pk': obj._get_pk_val()}), "count_url": _reverse('comments-xtd-api-count', kwargs={'content_type': ctype_slug, - 'object_pk': obj.id}), + 'object_pk': obj._get_pk_val()}), "send_url": _reverse("comments-xtd-api-create"), "preview_url": _reverse("comments-xtd-api-preview"), "form": {