fix: target

This commit is contained in:
Jean-Baptiste Pasquier 2021-03-29 17:12:23 +02:00
parent 3e9b8a595f
commit 1e184776a4
1 changed files with 4 additions and 1 deletions

View File

@ -220,7 +220,10 @@ def send_email_on_notification(sender, instance, created, **kwargs):
# get identifier for resource triggering notification, and store in where
try:
if instance.object.startswith(settings.SITE_URL):
where = str(Model.resolve_id(instance.object.replace(settings.SITE_URL, '')).name)
if hasattr(Model.resolve_id(instance.object.replace(settings.SITE_URL, '')), 'get_full_name'):
where = Model.resolve_id(instance.object.replace(settings.SITE_URL, '')).get_full_name()
else:
where = str(Model.resolve_id(instance.object.replace(settings.SITE_URL, '')).name)
else:
where = requests.get(instance.object).json()['name']
except: