From efdd3ab086f16839538e3024e6687899e7e4d1e6 Mon Sep 17 00:00:00 2001 From: Igor Malinovskiy Date: Wed, 18 May 2022 15:44:37 +0200 Subject: [PATCH] Assign copy of kwargs instead of direct reference Make a shallow copy of kwargs and assign it to the data attribute. It allows overriding the save method of the model which can modify data if needed. --- notifications/base/models.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/notifications/base/models.py b/notifications/base/models.py index 05eaac4..8870250 100644 --- a/notifications/base/models.py +++ b/notifications/base/models.py @@ -320,7 +320,7 @@ def notify_handler(verb, **kwargs): ContentType.objects.get_for_model(obj)) if kwargs and EXTRA_DATA: - newnotify.data = kwargs + newnotify.data = kwargs.copy() newnotify.save() new_notifications.append(newnotify)