fix: no nested subscriptions on the user model
This commit is contained in:
parent
4d5b61602d
commit
63b437e9d9
@ -2,6 +2,7 @@ import logging
|
|||||||
|
|
||||||
import requests
|
import requests
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
|
from django.contrib.auth import get_user_model
|
||||||
from django.core.mail import send_mail
|
from django.core.mail import send_mail
|
||||||
from django.core.exceptions import ObjectDoesNotExist
|
from django.core.exceptions import ObjectDoesNotExist
|
||||||
from django.db import models
|
from django.db import models
|
||||||
@ -77,6 +78,10 @@ def create_nested_subscribers(sender, instance, created, **kwargs):
|
|||||||
local = Model.resolve(instance.object.replace(settings.SITE_URL, ''))[0]
|
local = Model.resolve(instance.object.replace(settings.SITE_URL, ''))[0]
|
||||||
nested_fields = Model.get_meta(local, 'nested_fields', [])
|
nested_fields = Model.get_meta(local, 'nested_fields', [])
|
||||||
|
|
||||||
|
# Don't create nested subscriptions for user model (Notification loop issue)
|
||||||
|
if local._meta.model_name == get_user_model()._meta.model_name:
|
||||||
|
return
|
||||||
|
|
||||||
for nested_field in nested_fields:
|
for nested_field in nested_fields:
|
||||||
try:
|
try:
|
||||||
field = local._meta.get_field(nested_field)
|
field = local._meta.get_field(nested_field)
|
||||||
|
Loading…
Reference in New Issue
Block a user