From 736f641fa39a58f8eeb2b4476cb2034f8924ef52 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 f565a5f..43f9ee3 100644 --- a/notifications/base/models.py +++ b/notifications/base/models.py @@ -301,7 +301,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)