bugfix: model resource_id
This commit is contained in:
parent
9694472c89
commit
6b6a5e1e8c
@ -47,16 +47,16 @@ class Subscription(models.Model):
|
|||||||
def send_notification(sender, instance, **kwargs):
|
def send_notification(sender, instance, **kwargs):
|
||||||
if (sender != Notification and sender != LogEntry):
|
if (sender != Notification and sender != LogEntry):
|
||||||
threads = []
|
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):
|
for subscription in Subscription.objects.filter(object=url):
|
||||||
process = Thread(target=send_request, args=[subscription.inbox, url])
|
process = Thread(target=send_request, args=[subscription.inbox, url])
|
||||||
process.start()
|
process.start()
|
||||||
threads.append(process)
|
threads.append(process)
|
||||||
def send_request(target, objectIri):
|
def send_request(target, object_iri):
|
||||||
try:
|
try:
|
||||||
req=requests.post(target,
|
req=requests.post(target,
|
||||||
json={"@context":"https://cdn.happy-dev.fr/owl/hdcontext.jsonld",
|
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"})
|
headers={"Content-Type": "application/ld+json"})
|
||||||
except:
|
except:
|
||||||
logging.error('Djangoldp_notifications: Error with request')
|
logging.error('Djangoldp_notifications: Error with request')
|
||||||
|
Loading…
Reference in New Issue
Block a user