Forráskód Böngészése

Fixes #4929: Correct log message when creating a new object

Jeremy Stretch 5 éve
szülő
commit
24cedab04b
2 módosított fájl, 3 hozzáadás és 1 törlés
  1. 1 0
      docs/release-notes/version-2.8.md
  2. 2 1
      netbox/utilities/views.py

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

@@ -16,6 +16,7 @@
 * [#4894](https://github.com/netbox-community/netbox/issues/4894) - Fix display of device/VM counts on platforms list
 * [#4895](https://github.com/netbox-community/netbox/issues/4895) - Force UTF-8 encoding when embedding model documentation
 * [#4910](https://github.com/netbox-community/netbox/issues/4910) - Unpin redis dependency to fix exception in RQ worker
+* [#4929](https://github.com/netbox-community/netbox/issues/4929) - Correct log message when creating a new object
 
 ---
 

+ 2 - 1
netbox/utilities/views.py

@@ -267,9 +267,10 @@ class ObjectEditView(GetReturnURLMixin, View):
         if form.is_valid():
             logger.debug("Form validation was successful")
 
+            object_created = form.instance.pk is None
             obj = form.save()
             msg = '{} {}'.format(
-                'Created' if not form.instance.pk else 'Modified',
+                'Created' if object_created else 'Modified',
                 self.model._meta.verbose_name
             )
             logger.info(f"{msg} {obj} (PK: {obj.pk})")