From dcd9b777b174540e7434f6a13b7b2c3b2671feca Mon Sep 17 00:00:00 2001 From: "madjid.asa" Date: Wed, 27 Nov 2024 14:31:20 +0100 Subject: [PATCH] fix tests --- lemarche/users/models.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lemarche/users/models.py b/lemarche/users/models.py index 7f0e64e6b..804717f6d 100644 --- a/lemarche/users/models.py +++ b/lemarche/users/models.py @@ -419,11 +419,11 @@ def update_api_key_last_update(sender, instance, **kwargs): try: old_instance = sender.objects.get(pk=instance.pk) if old_instance.api_key != instance.api_key: - # Add the old key to the list of old keys instance.api_key_last_updated = timezone.now() except sender.DoesNotExist: - instance.api_key_last_updated = timezone.now() - else: + if instance.api_key: + instance.api_key_last_updated = timezone.now() + elif instance.api_key: instance.api_key_last_updated = timezone.now()