Просмотр исходного кода

Closes #4005: Include timezone context in webhook timestamps

Jeremy Stretch 6 лет назад
Родитель
Сommit
d3463b596a
2 измененных файлов с 3 добавлено и 1 удалено
  1. 1 0
      docs/release-notes/version-2.7.md
  2. 2 1
      netbox/extras/webhooks.py

+ 1 - 0
docs/release-notes/version-2.7.md

@@ -4,6 +4,7 @@
 
 * [#3310](https://github.com/netbox-community/netbox/issues/3310) - Pre-select site/rack for B side when creating a new cable
 * [#3509](https://github.com/netbox-community/netbox/issues/3509) - Add IP address variables for custom scripts
+* [#4005](https://github.com/netbox-community/netbox/issues/4005) - Include timezone context in webhook timestamps
 
 ## Bug Fixes
 

+ 2 - 1
netbox/extras/webhooks.py

@@ -3,6 +3,7 @@ import hashlib
 import hmac
 
 from django.contrib.contenttypes.models import ContentType
+from django.utils import timezone
 
 from extras.models import Webhook
 from utilities.api import get_serializer_for_model
@@ -62,7 +63,7 @@ def enqueue_webhooks(instance, user, request_id, action):
                 serializer.data,
                 instance._meta.model_name,
                 action,
-                str(datetime.datetime.now()),
+                str(timezone.now()),
                 user.username,
                 request_id
             )