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')