Repository: nautobot/nautobot

Issue:
Changelog Filter "Object Type" - The results could not be loaded.
<!--
    NOTE: IF YOUR ISSUE DOES NOT FOLLOW THIS TEMPLATE, IT WILL BE CLOSED.

    This form is only for reporting reproducible bugs. If you need assistance
    with Nautobot installation, or if you have a general question, please start a
    discussion instead: https://github.com/nautobot/nautobot/discussions

    Please describe the environment in which you are running Nautobot. Be sure
    that you are running an unmodified instance of the latest stable release
    before submitting a bug report, and that any plugins have been disabled.
-->
### Environment
* Nautobot version (Docker tag too if applicable): d3bb49d5c396 (v1.4.7)
* Python version: 3.9
* Database platform, version: postgres
* Middleware(s):

<!--
    Describe in detail the exact steps that someone else can take to reproduce
    this bug using the current stable release of Nautobot. Begin with the
    creation of any necessary database objects and call out every operation
    being performed explicitly. If reporting a bug in the REST API, be sure to
    reconstruct the raw HTTP request(s) being made: Don't rely on a client
    library such as pynautobot.
-->
### Steps to Reproduce
1. Open Changelog
2. Klick into "Object Type" on "Serach" Field
3.

<!-- What did you expect to happen? -->
### Expected Behavior
A list of object types should be displayed

<!-- What happened instead? -->
### Observed Behavior

![image](https://user-images.githubusercontent.com/8406301/197801973-f02e2850-24f2-4198-a615-4f4d44de0258.png)





Discussion:
Thanks for the report! Looks to be an issue resulting from `STRICT_FILTERING` as the query being sent is:

```
GET /api/extras/content-types/?q=&limit=50&offset=0&brief=true
```

and the response is:

```
{"q": [ "Unknown filter field" ]}
```

Resolving patch:
diff --git a/nautobot/extras/filters.py b/nautobot/extras/filters.py
--- a/nautobot/extras/filters.py
+++ b/nautobot/extras/filters.py
@@ -416,6 +416,13 @@ class Meta:
 
 
 class ContentTypeFilterSet(BaseFilterSet):
+    q = SearchFilter(
+        filter_predicates={
+            "app_label": "icontains",
+            "model": "icontains",
+        },
+    )
+
     class Meta:
         model = ContentType
         fields = ["id", "app_label", "model"]


Test patch:
diff --git a/nautobot/extras/tests/test_filters.py b/nautobot/extras/tests/test_filters.py
--- a/nautobot/extras/tests/test_filters.py
+++ b/nautobot/extras/tests/test_filters.py
@@ -2,6 +2,7 @@
 
 from django.contrib.auth import get_user_model
 from django.contrib.contenttypes.models import ContentType
+from django.db.models import Q
 
 from nautobot.dcim.filters import DeviceFilterSet
 from nautobot.dcim.models import (
@@ -24,6 +25,7 @@
 from nautobot.extras.filters import (
     ComputedFieldFilterSet,
     ConfigContextFilterSet,
+    ContentTypeFilterSet,
     CustomLinkFilterSet,
     ExportTemplateFilterSet,
     GitRepositoryFilterSet,
@@ -312,6 +314,28 @@ def test_search(self):
         self.assertEqual(self.filterset(params, self.queryset).qs.values_list("pk", flat=True)[0], value)
 
 
+class ContentTypeFilterSetTestCase(FilterTestCases.FilterTestCase):
+    queryset = ContentType.objects.order_by("app_label", "model")
+    filterset = ContentTypeFilterSet
+
+    def test_app_label(self):
+        params = {"app_label": ["dcim"]}
+        self.assertQuerysetEqual(self.filterset(params, self.queryset).qs, self.queryset.filter(app_label="dcim"))
+
+    def test_model(self):
+        params = {"model": ["device", "virtualmachine"]}
+        self.assertQuerysetEqual(
+            self.filterset(params, self.queryset).qs, self.queryset.filter(model__in=["device", "virtualmachine"])
+        )
+
+    def test_search(self):
+        params = {"q": "circ"}
+        self.assertQuerysetEqual(
+            self.filterset(params, self.queryset).qs,
+            self.queryset.filter(Q(app_label__icontains="circ") | Q(model__icontains="circ")),
+        )
+
+
 class CustomLinkTestCase(FilterTestCases.FilterTestCase):
     queryset = CustomLink.objects.all()
     filterset = CustomLinkFilterSet