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

This commit is contained in:
Jeremy Stretch 2020-07-30 08:51:01 -04:00
parent 4262e2ef09
commit 24cedab04b
2 changed files with 3 additions and 1 deletions

View File

@ -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
---

View File

@ -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})")