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

Fixes #9891: Ensure consistent ordering for tags during object serialization

jeremystretch 3 лет назад
Родитель
Сommit
9fe5f09742
2 измененных файлов с 6 добавлено и 2 удалено
  1. 5 1
      docs/release-notes/version-3.2.md
  2. 1 1
      netbox/utilities/utils.py

+ 5 - 1
docs/release-notes/version-3.2.md

@@ -4,11 +4,15 @@
 
 
 ### Enhancements
 ### Enhancements
 
 
-* [#9062](https://github.com/netbox-community/netbox/issues/9062) - Add/edit {module} substitution to help text for component template name 
+* [#9062](https://github.com/netbox-community/netbox/issues/9062) - Add/edit {module} substitution to help text for component template name
 * [#9637](https://github.com/netbox-community/netbox/issues/9637) - Add site group field to rack reservation form
 * [#9637](https://github.com/netbox-community/netbox/issues/9637) - Add site group field to rack reservation form
 * [#9762](https://github.com/netbox-community/netbox/issues/9762) - Add `nat_outside` column to the IPAddress table
 * [#9762](https://github.com/netbox-community/netbox/issues/9762) - Add `nat_outside` column to the IPAddress table
 * [#9825](https://github.com/netbox-community/netbox/issues/9825) - Add contacts column to virtual machines table
 * [#9825](https://github.com/netbox-community/netbox/issues/9825) - Add contacts column to virtual machines table
 
 
+### Bug Fixes
+
+* [#9891](https://github.com/netbox-community/netbox/issues/9891) - Ensure consistent ordering for tags during object serialization
+
 ---
 ---
 
 
 ## v3.2.7 (2022-07-20)
 ## v3.2.7 (2022-07-20)

+ 1 - 1
netbox/utilities/utils.py

@@ -148,7 +148,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', None) or obj.tags.all()
         tags = getattr(obj, '_tags', None) or obj.tags.all()
-        data['tags'] = [tag.name for tag in tags]
+        data['tags'] = sorted([tag.name for tag in tags])
 
 
     # Append any extra data
     # Append any extra data
     if extra is not None:
     if extra is not None: