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

Merge branch 'develop' into feature

Arthur 3 лет назад
Родитель
Сommit
e95708fe08
3 измененных файлов с 16 добавлено и 2 удалено
  1. 13 0
      docs/customization/custom-scripts.md
  2. 1 0
      docs/release-notes/version-3.3.md
  3. 2 2
      netbox/dcim/views.py

+ 13 - 0
docs/customization/custom-scripts.md

@@ -129,6 +129,19 @@ The Script object provides a set of convenient functions for recording messages
 
 
 Log messages are returned to the user upon execution of the script. Markdown rendering is supported for log messages.
 Log messages are returned to the user upon execution of the script. Markdown rendering is supported for log messages.
 
 
+## Change Logging
+
+To generate the correct change log data when editing an existing object, a snapshot of the object must be taken before making any changes to the object.
+
+```python
+if obj.pk and hasattr(obj, 'snapshot'):
+    obj.snapshot()
+
+obj.property = "New Value"
+obj.full_clean()
+obj.save()
+```
+
 ## Variable Reference
 ## Variable Reference
 
 
 ### Default Options
 ### Default Options

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

@@ -8,6 +8,7 @@
 
 
 ### Bug Fixes
 ### Bug Fixes
 
 
+* [#9497](https://github.com/netbox-community/netbox/issues/9497) - Adjust non-racked device filter on site and location detailed view
 * [#10383](https://github.com/netbox-community/netbox/issues/10383) - Fix assignment of component templates to module types via web UI
 * [#10383](https://github.com/netbox-community/netbox/issues/10383) - Fix assignment of component templates to module types via web UI
 * [#10387](https://github.com/netbox-community/netbox/issues/10387) - Fix `MultiValueDictKeyError` exception when editing a device interface
 * [#10387](https://github.com/netbox-community/netbox/issues/10387) - Fix `MultiValueDictKeyError` exception when editing a device interface
 
 

+ 2 - 2
netbox/dcim/views.py

@@ -355,7 +355,7 @@ class SiteView(generic.ObjectView):
 
 
         nonracked_devices = Device.objects.filter(
         nonracked_devices = Device.objects.filter(
             site=instance,
             site=instance,
-            position__isnull=True,
+            rack__isnull=True,
             parent_bay__isnull=True
             parent_bay__isnull=True
         ).prefetch_related('device_type__manufacturer', 'parent_bay', 'device_role')
         ).prefetch_related('device_type__manufacturer', 'parent_bay', 'device_role')
 
 
@@ -450,7 +450,7 @@ class LocationView(generic.ObjectView):
 
 
         nonracked_devices = Device.objects.filter(
         nonracked_devices = Device.objects.filter(
             location=instance,
             location=instance,
-            position__isnull=True,
+            rack__isnull=True,
             parent_bay__isnull=True
             parent_bay__isnull=True
         ).prefetch_related('device_type__manufacturer', 'parent_bay', 'device_role')
         ).prefetch_related('device_type__manufacturer', 'parent_bay', 'device_role')