From 6b6a5e1e8c0b9aec07a1fe75255ecd0d2478a880 Mon Sep 17 00:00:00 2001 From: Matthieu Fesselier Date: Wed, 6 Mar 2019 17:38:58 +0700 Subject: [PATCH] bugfix: model resource_id --- djangoldp_notification/models.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/djangoldp_notification/models.py b/djangoldp_notification/models.py index 8597b95..82cf3c2 100644 --- a/djangoldp_notification/models.py +++ b/djangoldp_notification/models.py @@ -47,16 +47,16 @@ class Subscription(models.Model): def send_notification(sender, instance, **kwargs): if (sender != Notification and sender != LogEntry): threads = [] - url = settings.BASE_URL + Model.get_absolute_url(instance) + '/' + url = settings.BASE_URL + Model.resource_id(instance) + '/' for subscription in Subscription.objects.filter(object=url): process = Thread(target=send_request, args=[subscription.inbox, url]) process.start() threads.append(process) -def send_request(target, objectIri): +def send_request(target, object_iri): try: req=requests.post(target, json={"@context":"https://cdn.happy-dev.fr/owl/hdcontext.jsonld", - "object": objectIri, "type": "update"}, + "object": object_iri, "type": "update"}, headers={"Content-Type": "application/ld+json"}) except: logging.error('Djangoldp_notifications: Error with request')