update: subscription for containers and resources
This commit is contained in:
parent
4d4b21e7e8
commit
d8ae6c1c75
@ -54,11 +54,12 @@ class Subscription(Model):
|
||||
# --- SUBSCRIPTION SYSTEM ---
|
||||
@receiver(post_save, dispatch_uid="callback_notif")
|
||||
def send_notification(sender, instance, **kwargs):
|
||||
if sender != Notification and isinstance(sender, Model):
|
||||
if sender != Notification and issubclass(sender, Model):
|
||||
threads = []
|
||||
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])
|
||||
urlContainer = settings.BASE_URL + Model.container_id(instance)
|
||||
urlResource = settings.BASE_URL + Model.resource_id(instance)
|
||||
for subscription in Subscription.objects.filter(models.Q(object=urlResource)|models.Q(object=urlContainer)):
|
||||
process = Thread(target=send_request, args=[subscription.inbox, urlResource])
|
||||
process.start()
|
||||
threads.append(process)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user