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

Fixes #6492: Correct tag population in post-change data resulting from REST API changes

jeremystretch 4 лет назад
Родитель
Сommit
0a0b852f2c
2 измененных файлов с 2 добавлено и 1 удалено
  1. 1 0
      docs/release-notes/version-2.11.md
  2. 1 1
      netbox/utilities/utils.py

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

@@ -13,6 +13,7 @@
 * [#6064](https://github.com/netbox-community/netbox/issues/6064) - Fix object permission assignments for user and group models
 * [#6064](https://github.com/netbox-community/netbox/issues/6064) - Fix object permission assignments for user and group models
 * [#6217](https://github.com/netbox-community/netbox/issues/6217) - Disallow passing of string values for integer custom fields
 * [#6217](https://github.com/netbox-community/netbox/issues/6217) - Disallow passing of string values for integer custom fields
 * [#6284](https://github.com/netbox-community/netbox/issues/6284) - Avoid sending redundant webhooks when adding/removing tags
 * [#6284](https://github.com/netbox-community/netbox/issues/6284) - Avoid sending redundant webhooks when adding/removing tags
+* [#6492](https://github.com/netbox-community/netbox/issues/6492) - Correct tag population in post-change data resulting from REST API changes
 * [#6496](https://github.com/netbox-community/netbox/issues/6496) - Fix upgrade script when Python installed in nonstandard path
 * [#6496](https://github.com/netbox-community/netbox/issues/6496) - Fix upgrade script when Python installed in nonstandard path
 * [#6502](https://github.com/netbox-community/netbox/issues/6502) - Correct permissions evaluation for running a report via the REST API
 * [#6502](https://github.com/netbox-community/netbox/issues/6502) - Correct permissions evaluation for running a report via the REST API
 * [#6517](https://github.com/netbox-community/netbox/issues/6517) - Fix assignment of user when creating rack reservations via REST API
 * [#6517](https://github.com/netbox-community/netbox/issues/6517) - Fix assignment of user when creating rack reservations via REST API

+ 1 - 1
netbox/utilities/utils.py

@@ -105,7 +105,7 @@ def serialize_object(obj, extra=None):
 
 
     # Include any tags. Check for tags cached on the instance; fall back to using the manager.
     # Include any tags. Check for tags cached on the instance; fall back to using the manager.
     if is_taggable(obj):
     if is_taggable(obj):
-        tags = getattr(obj, '_tags', obj.tags.all())
+        tags = getattr(obj, '_tags', None) or obj.tags.all()
         data['tags'] = [tag.name for tag in tags]
         data['tags'] = [tag.name for tag in tags]
 
 
     # Append any extra data
     # Append any extra data