Repository: netbox-community/netbox

Issue:
Bulk import with updates returns empty page - Wrong output filter
### NetBox version

v3.5.6

### Python version

3.8

### Steps to Reproduce

1 - Prepare a bulk import CSV, with ip_address, vrf, status, dns_name and description along with id, so already existing object would be updated.
2- Using WebUI, proceed with import at /ipam/ip-addresses/import/.
3- Notice that resulting URL is using "/?created_by_request=UID_HERE" 

### Expected Behavior

A green toast notification saying all good, and the results being displayed on the page, like this: 
![image](https://github.com/netbox-community/netbox/assets/25624251/8dcacb78-6991-47ae-8995-2e8737eaaee8)


### Observed Behavior

A green toast notification saying all good, and an empty page saying "No IP addresses found":
![image](https://github.com/netbox-community/netbox/assets/25624251/4955896c-383a-4e48-b1ce-af6b9eaa406b)



Discussion:
Thanks @kkthxbye-code for quickly identifying the bug 👍 

Resolving patch:
diff --git a/netbox/netbox/filtersets.py b/netbox/netbox/filtersets.py
--- a/netbox/netbox/filtersets.py
+++ b/netbox/netbox/filtersets.py
@@ -246,18 +246,22 @@ class ChangeLoggedModelFilterSet(BaseFilterSet):
     updated_by_request = django_filters.UUIDFilter(
         method='filter_by_request'
     )
+    modified_by_request = django_filters.UUIDFilter(
+        method='filter_by_request'
+    )
 
     def filter_by_request(self, queryset, name, value):
         content_type = ContentType.objects.get_for_model(self.Meta.model)
         action = {
-            'created_by_request': ObjectChangeActionChoices.ACTION_CREATE,
-            'updated_by_request': ObjectChangeActionChoices.ACTION_UPDATE,
+            'created_by_request': Q(action=ObjectChangeActionChoices.ACTION_CREATE),
+            'updated_by_request': Q(action=ObjectChangeActionChoices.ACTION_UPDATE),
+            'modified_by_request': Q(action__in=[ObjectChangeActionChoices.ACTION_CREATE, ObjectChangeActionChoices.ACTION_UPDATE]),
         }.get(name)
         request_id = value
         pks = ObjectChange.objects.filter(
+            action,
             changed_object_type=content_type,
-            action=action,
-            request_id=request_id
+            request_id=request_id,
         ).values_list('changed_object_id', flat=True)
         return queryset.filter(pk__in=pks)
 
diff --git a/netbox/netbox/views/generic/bulk_views.py b/netbox/netbox/views/generic/bulk_views.py
--- a/netbox/netbox/views/generic/bulk_views.py
+++ b/netbox/netbox/views/generic/bulk_views.py
@@ -458,7 +458,7 @@ def post(self, request):
                     messages.success(request, msg)
 
                     view_name = get_viewname(model, action='list')
-                    results_url = f"{reverse(view_name)}?created_by_request={request.id}"
+                    results_url = f"{reverse(view_name)}?modified_by_request={request.id}"
                     return redirect(results_url)
 
             except (AbortTransaction, ValidationError):


Test patch:
diff --git a/netbox/extras/tests/test_filtersets.py b/netbox/extras/tests/test_filtersets.py
--- a/netbox/extras/tests/test_filtersets.py
+++ b/netbox/extras/tests/test_filtersets.py
@@ -965,11 +965,13 @@ def setUpTestData(cls):
             Site(name='Site 1', slug='site-1'),
             Site(name='Site 2', slug='site-2'),
             Site(name='Site 3', slug='site-3'),
+            Site(name='Site 4', slug='site-4'),
         )
         Site.objects.bulk_create(sites)
 
         # Simulate *creation* changelog records for two of the sites
         request_id = uuid.uuid4()
+        cls.create_request_id = request_id
         objectchanges = (
             ObjectChange(
                 changed_object_type=content_type,
@@ -988,6 +990,7 @@ def setUpTestData(cls):
 
         # Simulate *update* changelog records for two of the sites
         request_id = uuid.uuid4()
+        cls.update_request_id = request_id
         objectchanges = (
             ObjectChange(
                 changed_object_type=content_type,
@@ -1004,14 +1007,36 @@ def setUpTestData(cls):
         )
         ObjectChange.objects.bulk_create(objectchanges)
 
+        # Simulate *create* and *update* changelog records for two of the sites
+        request_id = uuid.uuid4()
+        cls.create_update_request_id = request_id
+        objectchanges = (
+            ObjectChange(
+                changed_object_type=content_type,
+                changed_object_id=sites[2].pk,
+                action=ObjectChangeActionChoices.ACTION_CREATE,
+                request_id=request_id
+            ),
+            ObjectChange(
+                changed_object_type=content_type,
+                changed_object_id=sites[3].pk,
+                action=ObjectChangeActionChoices.ACTION_UPDATE,
+                request_id=request_id
+            ),
+        )
+        ObjectChange.objects.bulk_create(objectchanges)
+
     def test_created_by_request(self):
-        request_id = ObjectChange.objects.filter(action=ObjectChangeActionChoices.ACTION_CREATE).first().request_id
-        params = {'created_by_request': request_id}
+        params = {'created_by_request': self.create_request_id}
         self.assertEqual(self.filterset(params, self.queryset).qs.count(), 2)
-        self.assertEqual(self.queryset.count(), 3)
+        self.assertEqual(self.queryset.count(), 4)
 
     def test_updated_by_request(self):
-        request_id = ObjectChange.objects.filter(action=ObjectChangeActionChoices.ACTION_UPDATE).first().request_id
-        params = {'updated_by_request': request_id}
+        params = {'updated_by_request': self.update_request_id}
+        self.assertEqual(self.filterset(params, self.queryset).qs.count(), 2)
+        self.assertEqual(self.queryset.count(), 4)
+
+    def test_modified_by_request(self):
+        params = {'modified_by_request': self.create_update_request_id}
         self.assertEqual(self.filterset(params, self.queryset).qs.count(), 2)
-        self.assertEqual(self.queryset.count(), 3)
+        self.assertEqual(self.queryset.count(), 4)