Browse Source

Closes #3352: Enable filtering changelog API by changed_object_id

Jeremy Stretch 6 years ago
parent
commit
d183a9e7b5
3 changed files with 6 additions and 3 deletions
  1. 1 0
      CHANGELOG.md
  2. 2 2
      netbox/extras/api/serializers.py
  3. 3 1
      netbox/extras/filters.py

+ 1 - 0
CHANGELOG.md

@@ -2,6 +2,7 @@ v2.6.5 (FUTURE)
 
 ## Enhancements
 
+* [#3352](https://github.com/netbox-community/netbox/issues/3352) -  Enable filtering changelog API by `changed_object_id`
 * [#3524](https://github.com/netbox-community/netbox/issues/3524) -  Enable bulk editing of power outlet/power port associations
 * [#3529](https://github.com/netbox-community/netbox/issues/3529) -  Enable filtering circuits list by region
 

+ 2 - 2
netbox/extras/api/serializers.py

@@ -235,8 +235,8 @@ class ObjectChangeSerializer(serializers.ModelSerializer):
     class Meta:
         model = ObjectChange
         fields = [
-            'id', 'time', 'user', 'user_name', 'request_id', 'action', 'changed_object_type', 'changed_object',
-            'object_data',
+            'id', 'time', 'user', 'user_name', 'request_id', 'action', 'changed_object_type', 'changed_object_id',
+            'changed_object', 'object_data',
         ]
 
     @swagger_serializer_method(serializer_or_field=serializers.DictField)

+ 3 - 1
netbox/extras/filters.py

@@ -230,7 +230,9 @@ class ObjectChangeFilter(django_filters.FilterSet):
 
     class Meta:
         model = ObjectChange
-        fields = ['user', 'user_name', 'request_id', 'action', 'changed_object_type', 'object_repr']
+        fields = [
+            'user', 'user_name', 'request_id', 'action', 'changed_object_type', 'changed_object_id', 'object_repr',
+        ]
 
     def search(self, queryset, name, value):
         if not value.strip():