We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Filter by release channel on ASRSnippets raises an error


--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `snippets/base/admin/filters.py`
Content:
```
1 from datetime import datetime, timedelta
2 
3 from django.contrib import admin
4 from django.utils.encoding import force_text
5 
6 
7 class ModifiedFilter(admin.SimpleListFilter):
8     title = 'Last modified'
9     parameter_name = 'last_modified'
10 
11     def lookups(self, request, model_admin):
12         return (
13             ('24', '24 hours'),
14             ('168', '7 days'),
15             ('336', '14 days'),
16             ('720', '30 days'),
17             ('all', 'All'),
18         )
19 
20     def queryset(self, request, queryset):
21         value = self.value()
22         if not value or value == 'all':
23             return queryset
24 
25         when = datetime.utcnow() - timedelta(hours=int(value))
26         return queryset.exclude(modified__lt=when)
27 
28     def choices(self, cl):
29         for lookup, title in self.lookup_choices:
30             yield {
31                 'selected': self.value() == force_text(lookup),
32                 'query_string': cl.get_query_string({
33                     self.parameter_name: lookup,
34                 }, []),
35                 'display': title,
36             }
37 
38 
39 class ChannelFilter(admin.SimpleListFilter):
40     title = 'Channel'
41     parameter_name = 'channel'
42 
43     def lookups(self, request, model_admin):
44         return (
45             ('on_release', 'Release'),
46             ('on_esr', 'ESR'),
47             ('on_beta', 'Beta'),
48             ('on_aurora', 'Dev (Aurora)'),
49             ('on_nightly', 'Nightly'),
50         )
51 
52     def queryset(self, request, queryset):
53         if self.value() is None:
54             return queryset
55 
56         return queryset.filter(**{self.value(): True})
57 
58 
59 class ActivityStreamFilter(admin.SimpleListFilter):
60     title = 'Activity Stream'
61     parameter_name = 'is_activity_stream'
62 
63     def lookups(self, request, model_admin):
64         return (
65             ('yes', 'Yes'),
66             ('no', 'No'),
67         )
68 
69     def queryset(self, request, queryset):
70         if self.value() is None:
71             return queryset
72         elif self.value() == 'yes':
73             return queryset.filter(on_startpage_5=True)
74         elif self.value() == 'no':
75             return queryset.exclude(on_startpage_5=True)
76
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/snippets/base/admin/filters.py b/snippets/base/admin/filters.py
--- a/snippets/base/admin/filters.py
+++ b/snippets/base/admin/filters.py
@@ -3,6 +3,8 @@
 from django.contrib import admin
 from django.utils.encoding import force_text
 
+from snippets.base.managers import SnippetQuerySet
+
 
 class ModifiedFilter(admin.SimpleListFilter):
     title = 'Last modified'
@@ -53,7 +55,9 @@
         if self.value() is None:
             return queryset
 
-        return queryset.filter(**{self.value(): True})
+        if isinstance(queryset, SnippetQuerySet):
+            return queryset.filter(**{self.value(): True})
+        return queryset.filter(**{f'target__{self.value()}': True})
 
 
 class ActivityStreamFilter(admin.SimpleListFilter):

{"golden_diff": "diff --git a/snippets/base/admin/filters.py b/snippets/base/admin/filters.py\n--- a/snippets/base/admin/filters.py\n+++ b/snippets/base/admin/filters.py\n@@ -3,6 +3,8 @@\n from django.contrib import admin\n from django.utils.encoding import force_text\n \n+from snippets.base.managers import SnippetQuerySet\n+\n \n class ModifiedFilter(admin.SimpleListFilter):\n     title = 'Last modified'\n@@ -53,7 +55,9 @@\n         if self.value() is None:\n             return queryset\n \n-        return queryset.filter(**{self.value(): True})\n+        if isinstance(queryset, SnippetQuerySet):\n+            return queryset.filter(**{self.value(): True})\n+        return queryset.filter(**{f'target__{self.value()}': True})\n \n \n class ActivityStreamFilter(admin.SimpleListFilter):\n", "issue": "Filter by release channel on ASRSnippets raises an error\n\n", "before_files": [{"content": "from datetime import datetime, timedelta\n\nfrom django.contrib import admin\nfrom django.utils.encoding import force_text\n\n\nclass ModifiedFilter(admin.SimpleListFilter):\n    title = 'Last modified'\n    parameter_name = 'last_modified'\n\n    def lookups(self, request, model_admin):\n        return (\n            ('24', '24 hours'),\n            ('168', '7 days'),\n            ('336', '14 days'),\n            ('720', '30 days'),\n            ('all', 'All'),\n        )\n\n    def queryset(self, request, queryset):\n        value = self.value()\n        if not value or value == 'all':\n            return queryset\n\n        when = datetime.utcnow() - timedelta(hours=int(value))\n        return queryset.exclude(modified__lt=when)\n\n    def choices(self, cl):\n        for lookup, title in self.lookup_choices:\n            yield {\n                'selected': self.value() == force_text(lookup),\n                'query_string': cl.get_query_string({\n                    self.parameter_name: lookup,\n                }, []),\n                'display': title,\n            }\n\n\nclass ChannelFilter(admin.SimpleListFilter):\n    title = 'Channel'\n    parameter_name = 'channel'\n\n    def lookups(self, request, model_admin):\n        return (\n            ('on_release', 'Release'),\n            ('on_esr', 'ESR'),\n            ('on_beta', 'Beta'),\n            ('on_aurora', 'Dev (Aurora)'),\n            ('on_nightly', 'Nightly'),\n        )\n\n    def queryset(self, request, queryset):\n        if self.value() is None:\n            return queryset\n\n        return queryset.filter(**{self.value(): True})\n\n\nclass ActivityStreamFilter(admin.SimpleListFilter):\n    title = 'Activity Stream'\n    parameter_name = 'is_activity_stream'\n\n    def lookups(self, request, model_admin):\n        return (\n            ('yes', 'Yes'),\n            ('no', 'No'),\n        )\n\n    def queryset(self, request, queryset):\n        if self.value() is None:\n            return queryset\n        elif self.value() == 'yes':\n            return queryset.filter(on_startpage_5=True)\n        elif self.value() == 'no':\n            return queryset.exclude(on_startpage_5=True)\n", "path": "snippets/base/admin/filters.py"}], "after_files": [{"content": "from datetime import datetime, timedelta\n\nfrom django.contrib import admin\nfrom django.utils.encoding import force_text\n\nfrom snippets.base.managers import SnippetQuerySet\n\n\nclass ModifiedFilter(admin.SimpleListFilter):\n    title = 'Last modified'\n    parameter_name = 'last_modified'\n\n    def lookups(self, request, model_admin):\n        return (\n            ('24', '24 hours'),\n            ('168', '7 days'),\n            ('336', '14 days'),\n            ('720', '30 days'),\n            ('all', 'All'),\n        )\n\n    def queryset(self, request, queryset):\n        value = self.value()\n        if not value or value == 'all':\n            return queryset\n\n        when = datetime.utcnow() - timedelta(hours=int(value))\n        return queryset.exclude(modified__lt=when)\n\n    def choices(self, cl):\n        for lookup, title in self.lookup_choices:\n            yield {\n                'selected': self.value() == force_text(lookup),\n                'query_string': cl.get_query_string({\n                    self.parameter_name: lookup,\n                }, []),\n                'display': title,\n            }\n\n\nclass ChannelFilter(admin.SimpleListFilter):\n    title = 'Channel'\n    parameter_name = 'channel'\n\n    def lookups(self, request, model_admin):\n        return (\n            ('on_release', 'Release'),\n            ('on_esr', 'ESR'),\n            ('on_beta', 'Beta'),\n            ('on_aurora', 'Dev (Aurora)'),\n            ('on_nightly', 'Nightly'),\n        )\n\n    def queryset(self, request, queryset):\n        if self.value() is None:\n            return queryset\n\n        if isinstance(queryset, SnippetQuerySet):\n            return queryset.filter(**{self.value(): True})\n        return queryset.filter(**{f'target__{self.value()}': True})\n\n\nclass ActivityStreamFilter(admin.SimpleListFilter):\n    title = 'Activity Stream'\n    parameter_name = 'is_activity_stream'\n\n    def lookups(self, request, model_admin):\n        return (\n            ('yes', 'Yes'),\n            ('no', 'No'),\n        )\n\n    def queryset(self, request, queryset):\n        if self.value() is None:\n            return queryset\n        elif self.value() == 'yes':\n            return queryset.filter(on_startpage_5=True)\n        elif self.value() == 'no':\n            return queryset.exclude(on_startpage_5=True)\n", "path": "snippets/base/admin/filters.py"}]}