We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
List of people who taught at events of specific type
Usecase: Tracy wants to grab list of people who taught at DC workshops, so that she knows who is experienced DC instructor.


--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `workshops/filters.py`
Content:
```
1 from distutils.util import strtobool
2 
3 import django.forms.widgets
4 
5 import django_filters
6 from django_countries import Countries
7 
8 from workshops.models import Event, Host, Person, Task, Airport, EventRequest
9 
10 EMPTY_SELECTION = (None, '---------')
11 
12 
13 class AllCountriesFilter(django_filters.ChoiceFilter):
14     @property
15     def field(self):
16         qs = self.model._default_manager.distinct()
17         qs = qs.order_by(self.name).values_list(self.name, flat=True)
18 
19         choices = [o for o in qs if o]
20         countries = Countries()
21         countries.only = choices
22 
23         self.extra['choices'] = list(countries)
24         self.extra['choices'].insert(0, EMPTY_SELECTION)
25         return super().field
26 
27 
28 class ForeignKeyAllValuesFilter(django_filters.ChoiceFilter):
29     def __init__(self, model, *args, **kwargs):
30         self.lookup_model = model
31         super().__init__(*args, **kwargs)
32 
33     @property
34     def field(self):
35         name = self.name
36         model = self.lookup_model
37 
38         qs1 = self.model._default_manager.distinct()
39         qs1 = qs1.order_by(name).values_list(name, flat=True)
40         qs2 = model.objects.filter(pk__in=qs1)
41         self.extra['choices'] = [(o.pk, str(o)) for o in qs2]
42         self.extra['choices'].insert(0, EMPTY_SELECTION)
43         return super().field
44 
45 
46 class EventStateFilter(django_filters.ChoiceFilter):
47     def filter(self, qs, value):
48         if isinstance(value, django_filters.fields.Lookup):
49             value = value.value
50 
51         # no filtering
52         if value in ([], (), {}, None, '', 'all'):
53             return qs
54 
55         # no need to check if value exists in self.extra['choices'] because
56         # validation is done by django_filters
57         try:
58             return getattr(qs, "{}_events".format(value))()
59         except AttributeError:
60             return qs
61 
62 
63 class EventFilter(django_filters.FilterSet):
64     assigned_to = ForeignKeyAllValuesFilter(Person)
65     host = ForeignKeyAllValuesFilter(Host)
66     administrator = ForeignKeyAllValuesFilter(Host)
67 
68     STATUS_CHOICES = [
69         ('', 'All'),
70         ('past', 'Past'),
71         ('ongoing', 'Ongoing'),
72         ('upcoming', 'Upcoming'),
73         ('unpublished', 'Unpublished'),
74         ('uninvoiced', 'Uninvoiced'),
75     ]
76     status = EventStateFilter(choices=STATUS_CHOICES)
77 
78     invoice_status = django_filters.ChoiceFilter(
79         choices=(EMPTY_SELECTION, ) + Event.INVOICED_CHOICES,
80     )
81 
82     class Meta:
83         model = Event
84         fields = [
85             'assigned_to',
86             'tags',
87             'host',
88             'administrator',
89             'invoice_status',
90             'completed',
91         ]
92         order_by = ['-slug', 'slug', 'start', '-start', 'end', '-end']
93 
94 
95 class EventRequestFilter(django_filters.FilterSet):
96     assigned_to = ForeignKeyAllValuesFilter(Person)
97     country = AllCountriesFilter()
98     active = django_filters.TypedChoiceFilter(
99         choices=(('true', 'Open'), ('false', 'Closed')),
100         coerce=strtobool,
101         label='Status',
102         widget=django.forms.widgets.RadioSelect,
103     )
104 
105     class Meta:
106         model = EventRequest
107         fields = [
108             'assigned_to',
109             'workshop_type',
110             'active',
111             'country',
112         ]
113         order_by = ['-created_at', 'created_at']
114 
115 
116 class HostFilter(django_filters.FilterSet):
117     country = AllCountriesFilter()
118 
119     class Meta:
120         model = Host
121         fields = [
122             'country',
123         ]
124         order_by = ['fullname', '-fullname', 'domain', '-domain', ]
125 
126 
127 class PersonFilter(django_filters.FilterSet):
128     class Meta:
129         model = Person
130         fields = [
131             'badges',
132         ]
133         order_by = ["lastname", "-lastname", "firstname", "-firstname",
134                     "email", "-email"]
135 
136     def get_order_by(self, order_value):
137         if order_value == 'firstname':
138             return ['personal', 'middle', 'family']
139         elif order_value == '-firstname':
140             return ['-personal', '-middle', '-family']
141         elif order_value == 'lastname':
142             return ['family', 'middle', 'personal']
143         elif order_value == '-lastname':
144             return ['-family', '-middle', '-personal']
145         return super().get_order_by(order_value)
146 
147 
148 class TaskFilter(django_filters.FilterSet):
149     class Meta:
150         model = Task
151         fields = [
152             'event',
153             # can't filter on person because person's name contains 3 fields:
154             # person.personal, person.middle, person.family
155             # 'person',
156             'role',
157         ]
158         order_by = [
159             ['event__slug', 'Event'],
160             ['-event__slug', 'Event (descending)'],
161             ['person__family', 'Person'],
162             ['-person__family', 'Person (descending)'],
163             ['role', 'Role'],
164             ['-role', 'Role (descending)'],
165         ]
166 
167 
168 class AirportFilter(django_filters.FilterSet):
169     fullname = django_filters.CharFilter(lookup_type='icontains')
170 
171     class Meta:
172         model = Airport
173         fields = [
174             'fullname',
175         ]
176         order_by = ["iata", "-iata", "fullname", "-fullname"]
177
```
--- 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/workshops/filters.py b/workshops/filters.py
--- a/workshops/filters.py
+++ b/workshops/filters.py
@@ -5,7 +5,17 @@
 import django_filters
 from django_countries import Countries
 
-from workshops.models import Event, Host, Person, Task, Airport, EventRequest
+from workshops.models import (
+    Event,
+    Host,
+    Person,
+    Task,
+    Airport,
+    EventRequest,
+    Tag,
+    Role,
+    Task,
+)
 
 EMPTY_SELECTION = (None, '---------')
 
@@ -124,11 +134,31 @@
         order_by = ['fullname', '-fullname', 'domain', '-domain', ]
 
 
+def filter_taught_workshops(queryset, values):
+    """Limit Persons to only instructors from events with specific tags.
+
+    This needs to be in a separate function because django-filters doesn't
+    support `action` parameter as supposed, ie. with
+    `action='filter_taught_workshops'` it doesn't call the method; instead it
+    tries calling a string, which results in error."""
+    if not values:
+        return queryset
+
+    return queryset.filter(task__role__name='instructor') \
+                   .filter(task__event__tags__in=values) \
+                   .distinct()
+
+
 class PersonFilter(django_filters.FilterSet):
+    taught_workshops = django_filters.ModelMultipleChoiceFilter(
+        queryset=Tag.objects.all(), label='Taught at workshops of type',
+        action=filter_taught_workshops,
+    )
+
     class Meta:
         model = Person
         fields = [
-            'badges',
+            'badges', 'taught_workshops',
         ]
         order_by = ["lastname", "-lastname", "firstname", "-firstname",
                     "email", "-email"]

{"golden_diff": "diff --git a/workshops/filters.py b/workshops/filters.py\n--- a/workshops/filters.py\n+++ b/workshops/filters.py\n@@ -5,7 +5,17 @@\n import django_filters\n from django_countries import Countries\n \n-from workshops.models import Event, Host, Person, Task, Airport, EventRequest\n+from workshops.models import (\n+    Event,\n+    Host,\n+    Person,\n+    Task,\n+    Airport,\n+    EventRequest,\n+    Tag,\n+    Role,\n+    Task,\n+)\n \n EMPTY_SELECTION = (None, '---------')\n \n@@ -124,11 +134,31 @@\n         order_by = ['fullname', '-fullname', 'domain', '-domain', ]\n \n \n+def filter_taught_workshops(queryset, values):\n+    \"\"\"Limit Persons to only instructors from events with specific tags.\n+\n+    This needs to be in a separate function because django-filters doesn't\n+    support `action` parameter as supposed, ie. with\n+    `action='filter_taught_workshops'` it doesn't call the method; instead it\n+    tries calling a string, which results in error.\"\"\"\n+    if not values:\n+        return queryset\n+\n+    return queryset.filter(task__role__name='instructor') \\\n+                   .filter(task__event__tags__in=values) \\\n+                   .distinct()\n+\n+\n class PersonFilter(django_filters.FilterSet):\n+    taught_workshops = django_filters.ModelMultipleChoiceFilter(\n+        queryset=Tag.objects.all(), label='Taught at workshops of type',\n+        action=filter_taught_workshops,\n+    )\n+\n     class Meta:\n         model = Person\n         fields = [\n-            'badges',\n+            'badges', 'taught_workshops',\n         ]\n         order_by = [\"lastname\", \"-lastname\", \"firstname\", \"-firstname\",\n                     \"email\", \"-email\"]\n", "issue": "List of people who taught at events of specific type\nUsecase: Tracy wants to grab list of people who taught at DC workshops, so that she knows who is experienced DC instructor.\n\n", "before_files": [{"content": "from distutils.util import strtobool\n\nimport django.forms.widgets\n\nimport django_filters\nfrom django_countries import Countries\n\nfrom workshops.models import Event, Host, Person, Task, Airport, EventRequest\n\nEMPTY_SELECTION = (None, '---------')\n\n\nclass AllCountriesFilter(django_filters.ChoiceFilter):\n    @property\n    def field(self):\n        qs = self.model._default_manager.distinct()\n        qs = qs.order_by(self.name).values_list(self.name, flat=True)\n\n        choices = [o for o in qs if o]\n        countries = Countries()\n        countries.only = choices\n\n        self.extra['choices'] = list(countries)\n        self.extra['choices'].insert(0, EMPTY_SELECTION)\n        return super().field\n\n\nclass ForeignKeyAllValuesFilter(django_filters.ChoiceFilter):\n    def __init__(self, model, *args, **kwargs):\n        self.lookup_model = model\n        super().__init__(*args, **kwargs)\n\n    @property\n    def field(self):\n        name = self.name\n        model = self.lookup_model\n\n        qs1 = self.model._default_manager.distinct()\n        qs1 = qs1.order_by(name).values_list(name, flat=True)\n        qs2 = model.objects.filter(pk__in=qs1)\n        self.extra['choices'] = [(o.pk, str(o)) for o in qs2]\n        self.extra['choices'].insert(0, EMPTY_SELECTION)\n        return super().field\n\n\nclass EventStateFilter(django_filters.ChoiceFilter):\n    def filter(self, qs, value):\n        if isinstance(value, django_filters.fields.Lookup):\n            value = value.value\n\n        # no filtering\n        if value in ([], (), {}, None, '', 'all'):\n            return qs\n\n        # no need to check if value exists in self.extra['choices'] because\n        # validation is done by django_filters\n        try:\n            return getattr(qs, \"{}_events\".format(value))()\n        except AttributeError:\n            return qs\n\n\nclass EventFilter(django_filters.FilterSet):\n    assigned_to = ForeignKeyAllValuesFilter(Person)\n    host = ForeignKeyAllValuesFilter(Host)\n    administrator = ForeignKeyAllValuesFilter(Host)\n\n    STATUS_CHOICES = [\n        ('', 'All'),\n        ('past', 'Past'),\n        ('ongoing', 'Ongoing'),\n        ('upcoming', 'Upcoming'),\n        ('unpublished', 'Unpublished'),\n        ('uninvoiced', 'Uninvoiced'),\n    ]\n    status = EventStateFilter(choices=STATUS_CHOICES)\n\n    invoice_status = django_filters.ChoiceFilter(\n        choices=(EMPTY_SELECTION, ) + Event.INVOICED_CHOICES,\n    )\n\n    class Meta:\n        model = Event\n        fields = [\n            'assigned_to',\n            'tags',\n            'host',\n            'administrator',\n            'invoice_status',\n            'completed',\n        ]\n        order_by = ['-slug', 'slug', 'start', '-start', 'end', '-end']\n\n\nclass EventRequestFilter(django_filters.FilterSet):\n    assigned_to = ForeignKeyAllValuesFilter(Person)\n    country = AllCountriesFilter()\n    active = django_filters.TypedChoiceFilter(\n        choices=(('true', 'Open'), ('false', 'Closed')),\n        coerce=strtobool,\n        label='Status',\n        widget=django.forms.widgets.RadioSelect,\n    )\n\n    class Meta:\n        model = EventRequest\n        fields = [\n            'assigned_to',\n            'workshop_type',\n            'active',\n            'country',\n        ]\n        order_by = ['-created_at', 'created_at']\n\n\nclass HostFilter(django_filters.FilterSet):\n    country = AllCountriesFilter()\n\n    class Meta:\n        model = Host\n        fields = [\n            'country',\n        ]\n        order_by = ['fullname', '-fullname', 'domain', '-domain', ]\n\n\nclass PersonFilter(django_filters.FilterSet):\n    class Meta:\n        model = Person\n        fields = [\n            'badges',\n        ]\n        order_by = [\"lastname\", \"-lastname\", \"firstname\", \"-firstname\",\n                    \"email\", \"-email\"]\n\n    def get_order_by(self, order_value):\n        if order_value == 'firstname':\n            return ['personal', 'middle', 'family']\n        elif order_value == '-firstname':\n            return ['-personal', '-middle', '-family']\n        elif order_value == 'lastname':\n            return ['family', 'middle', 'personal']\n        elif order_value == '-lastname':\n            return ['-family', '-middle', '-personal']\n        return super().get_order_by(order_value)\n\n\nclass TaskFilter(django_filters.FilterSet):\n    class Meta:\n        model = Task\n        fields = [\n            'event',\n            # can't filter on person because person's name contains 3 fields:\n            # person.personal, person.middle, person.family\n            # 'person',\n            'role',\n        ]\n        order_by = [\n            ['event__slug', 'Event'],\n            ['-event__slug', 'Event (descending)'],\n            ['person__family', 'Person'],\n            ['-person__family', 'Person (descending)'],\n            ['role', 'Role'],\n            ['-role', 'Role (descending)'],\n        ]\n\n\nclass AirportFilter(django_filters.FilterSet):\n    fullname = django_filters.CharFilter(lookup_type='icontains')\n\n    class Meta:\n        model = Airport\n        fields = [\n            'fullname',\n        ]\n        order_by = [\"iata\", \"-iata\", \"fullname\", \"-fullname\"]\n", "path": "workshops/filters.py"}], "after_files": [{"content": "from distutils.util import strtobool\n\nimport django.forms.widgets\n\nimport django_filters\nfrom django_countries import Countries\n\nfrom workshops.models import (\n    Event,\n    Host,\n    Person,\n    Task,\n    Airport,\n    EventRequest,\n    Tag,\n    Role,\n    Task,\n)\n\nEMPTY_SELECTION = (None, '---------')\n\n\nclass AllCountriesFilter(django_filters.ChoiceFilter):\n    @property\n    def field(self):\n        qs = self.model._default_manager.distinct()\n        qs = qs.order_by(self.name).values_list(self.name, flat=True)\n\n        choices = [o for o in qs if o]\n        countries = Countries()\n        countries.only = choices\n\n        self.extra['choices'] = list(countries)\n        self.extra['choices'].insert(0, EMPTY_SELECTION)\n        return super().field\n\n\nclass ForeignKeyAllValuesFilter(django_filters.ChoiceFilter):\n    def __init__(self, model, *args, **kwargs):\n        self.lookup_model = model\n        super().__init__(*args, **kwargs)\n\n    @property\n    def field(self):\n        name = self.name\n        model = self.lookup_model\n\n        qs1 = self.model._default_manager.distinct()\n        qs1 = qs1.order_by(name).values_list(name, flat=True)\n        qs2 = model.objects.filter(pk__in=qs1)\n        self.extra['choices'] = [(o.pk, str(o)) for o in qs2]\n        self.extra['choices'].insert(0, EMPTY_SELECTION)\n        return super().field\n\n\nclass EventStateFilter(django_filters.ChoiceFilter):\n    def filter(self, qs, value):\n        if isinstance(value, django_filters.fields.Lookup):\n            value = value.value\n\n        # no filtering\n        if value in ([], (), {}, None, '', 'all'):\n            return qs\n\n        # no need to check if value exists in self.extra['choices'] because\n        # validation is done by django_filters\n        try:\n            return getattr(qs, \"{}_events\".format(value))()\n        except AttributeError:\n            return qs\n\n\nclass EventFilter(django_filters.FilterSet):\n    assigned_to = ForeignKeyAllValuesFilter(Person)\n    host = ForeignKeyAllValuesFilter(Host)\n    administrator = ForeignKeyAllValuesFilter(Host)\n\n    STATUS_CHOICES = [\n        ('', 'All'),\n        ('past', 'Past'),\n        ('ongoing', 'Ongoing'),\n        ('upcoming', 'Upcoming'),\n        ('unpublished', 'Unpublished'),\n        ('uninvoiced', 'Uninvoiced'),\n    ]\n    status = EventStateFilter(choices=STATUS_CHOICES)\n\n    invoice_status = django_filters.ChoiceFilter(\n        choices=(EMPTY_SELECTION, ) + Event.INVOICED_CHOICES,\n    )\n\n    class Meta:\n        model = Event\n        fields = [\n            'assigned_to',\n            'tags',\n            'host',\n            'administrator',\n            'invoice_status',\n            'completed',\n        ]\n        order_by = ['-slug', 'slug', 'start', '-start', 'end', '-end']\n\n\nclass EventRequestFilter(django_filters.FilterSet):\n    assigned_to = ForeignKeyAllValuesFilter(Person)\n    country = AllCountriesFilter()\n    active = django_filters.TypedChoiceFilter(\n        choices=(('true', 'Open'), ('false', 'Closed')),\n        coerce=strtobool,\n        label='Status',\n        widget=django.forms.widgets.RadioSelect,\n    )\n\n    class Meta:\n        model = EventRequest\n        fields = [\n            'assigned_to',\n            'workshop_type',\n            'active',\n            'country',\n        ]\n        order_by = ['-created_at', 'created_at']\n\n\nclass HostFilter(django_filters.FilterSet):\n    country = AllCountriesFilter()\n\n    class Meta:\n        model = Host\n        fields = [\n            'country',\n        ]\n        order_by = ['fullname', '-fullname', 'domain', '-domain', ]\n\n\ndef filter_taught_workshops(queryset, values):\n    \"\"\"Limit Persons to only instructors from events with specific tags.\n\n    This needs to be in a separate function because django-filters doesn't\n    support `action` parameter as supposed, ie. with\n    `action='filter_taught_workshops'` it doesn't call the method; instead it\n    tries calling a string, which results in error.\"\"\"\n    if not values:\n        return queryset\n\n    return queryset.filter(task__role__name='instructor') \\\n                   .filter(task__event__tags__in=values) \\\n                   .distinct()\n\n\nclass PersonFilter(django_filters.FilterSet):\n    taught_workshops = django_filters.ModelMultipleChoiceFilter(\n        queryset=Tag.objects.all(), label='Taught at workshops of type',\n        action=filter_taught_workshops,\n    )\n\n    class Meta:\n        model = Person\n        fields = [\n            'badges', 'taught_workshops',\n        ]\n        order_by = [\"lastname\", \"-lastname\", \"firstname\", \"-firstname\",\n                    \"email\", \"-email\"]\n\n    def get_order_by(self, order_value):\n        if order_value == 'firstname':\n            return ['personal', 'middle', 'family']\n        elif order_value == '-firstname':\n            return ['-personal', '-middle', '-family']\n        elif order_value == 'lastname':\n            return ['family', 'middle', 'personal']\n        elif order_value == '-lastname':\n            return ['-family', '-middle', '-personal']\n        return super().get_order_by(order_value)\n\n\nclass TaskFilter(django_filters.FilterSet):\n    class Meta:\n        model = Task\n        fields = [\n            'event',\n            # can't filter on person because person's name contains 3 fields:\n            # person.personal, person.middle, person.family\n            # 'person',\n            'role',\n        ]\n        order_by = [\n            ['event__slug', 'Event'],\n            ['-event__slug', 'Event (descending)'],\n            ['person__family', 'Person'],\n            ['-person__family', 'Person (descending)'],\n            ['role', 'Role'],\n            ['-role', 'Role (descending)'],\n        ]\n\n\nclass AirportFilter(django_filters.FilterSet):\n    fullname = django_filters.CharFilter(lookup_type='icontains')\n\n    class Meta:\n        model = Airport\n        fields = [\n            'fullname',\n        ]\n        order_by = [\"iata\", \"-iata\", \"fullname\", \"-fullname\"]\n", "path": "workshops/filters.py"}]}