We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Modify members API call so that JSON includes user ID
Right now the 'members' API gives us name and email - the JSON should include each person's user ID as well.


--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `api/serializers.py`
Content:
```
1 from rest_framework import serializers
2 
3 from workshops.models import Badge, Airport, Person, Event, TodoItem, Tag
4 
5 
6 class PersonUsernameSerializer(serializers.ModelSerializer):
7     name = serializers.CharField(source='get_full_name')
8     user = serializers.CharField(source='username')
9 
10     class Meta:
11         model = Person
12         fields = ('name', 'user', )
13 
14 
15 class PersonNameEmailSerializer(serializers.ModelSerializer):
16     name = serializers.CharField(source='get_full_name')
17 
18     class Meta:
19         model = Person
20         fields = ('name', 'email')
21 
22 
23 class ExportBadgesSerializer(serializers.ModelSerializer):
24     persons = PersonUsernameSerializer(many=True, source='person_set')
25 
26     class Meta:
27         model = Badge
28         fields = ('name', 'persons')
29 
30 
31 class ExportInstructorLocationsSerializer(serializers.ModelSerializer):
32     name = serializers.CharField(source='fullname')
33     instructors = PersonUsernameSerializer(many=True, source='person_set')
34 
35     class Meta:
36         model = Airport
37         fields = ('name', 'latitude', 'longitude', 'instructors', 'country')
38 
39 
40 class TagSerializer(serializers.ModelSerializer):
41     class Meta:
42         model = Tag
43         fields = ('name', )
44 
45 
46 class EventSerializer(serializers.ModelSerializer):
47     humandate = serializers.CharField(source='human_readable_date')
48     country = serializers.CharField()
49     start = serializers.DateField(format=None)
50     end = serializers.DateField(format=None)
51     url = serializers.URLField(source='website_url')
52     eventbrite_id = serializers.CharField(source='reg_key')
53     tags = TagSerializer(many=True)
54 
55     class Meta:
56         model = Event
57         fields = (
58             'slug', 'start', 'end', 'url', 'humandate', 'contact', 'country',
59             'venue', 'address', 'latitude', 'longitude', 'eventbrite_id',
60             'tags',
61         )
62 
63 
64 class TodoSerializer(serializers.ModelSerializer):
65     content = serializers.SerializerMethodField()
66     start = serializers.DateField(format=None, source='due')
67 
68     class Meta:
69         model = TodoItem
70         fields = (
71             'content', 'start',
72         )
73 
74     def get_content(self, obj):
75         """Return HTML containing interesting information for admins.  This
76         will be displayed on labels in the timeline."""
77 
78         return '<a href="{url}">{event}</a><br><small>{todo}</small>'.format(
79             url=obj.event.get_absolute_url(),
80             event=obj.event.get_ident(),
81             todo=obj.title,
82         )
83
```

Path: `api/views.py`
Content:
```
1 import datetime
2 
3 from django.db.models import Q
4 from rest_framework.generics import ListAPIView
5 from rest_framework.metadata import SimpleMetadata
6 from rest_framework.permissions import (
7     IsAuthenticatedOrReadOnly, IsAuthenticated
8 )
9 from rest_framework.response import Response
10 from rest_framework.reverse import reverse
11 from rest_framework.views import APIView
12 
13 from workshops.models import Badge, Airport, Event, TodoItem, Tag
14 from workshops.util import get_members, default_membership_cutoff
15 
16 from .serializers import (
17     PersonNameEmailSerializer,
18     ExportBadgesSerializer,
19     ExportInstructorLocationsSerializer,
20     EventSerializer,
21     TodoSerializer,
22 )
23 
24 
25 class QueryMetadata(SimpleMetadata):
26     """Additionally include info about query parameters."""
27 
28     def determine_metadata(self, request, view):
29         data = super().determine_metadata(request, view)
30 
31         try:
32             data['query_params'] = view.get_query_params_description()
33         except AttributeError:
34             pass
35 
36         return data
37 
38 
39 class ApiRoot(APIView):
40     def get(self, request, format=None):
41         return Response({
42             'export-badges': reverse('api:export-badges', request=request,
43                                      format=format),
44             'export-instructors': reverse('api:export-instructors',
45                                           request=request, format=format),
46             'export-members': reverse('api:export-members', request=request,
47                                       format=format),
48             'events-published': reverse('api:events-published',
49                                         request=request, format=format),
50             'user-todos': reverse('api:user-todos',
51                                   request=request, format=format),
52         })
53 
54 
55 class ExportBadgesView(ListAPIView):
56     """List all badges and people who have them."""
57     permission_classes = (IsAuthenticatedOrReadOnly, )
58     paginator = None  # disable pagination
59 
60     queryset = Badge.objects.prefetch_related('person_set')
61     serializer_class = ExportBadgesSerializer
62 
63 
64 class ExportInstructorLocationsView(ListAPIView):
65     """List all airports and instructors located near them."""
66     permission_classes = (IsAuthenticatedOrReadOnly, )
67     paginator = None  # disable pagination
68 
69     queryset = Airport.objects.exclude(person=None) \
70                               .prefetch_related('person_set')
71     serializer_class = ExportInstructorLocationsSerializer
72 
73 
74 class ExportMembersView(ListAPIView):
75     """Show everyone who qualifies as an SCF member."""
76     permission_classes = (IsAuthenticatedOrReadOnly, )
77     paginator = None  # disable pagination
78 
79     serializer_class = PersonNameEmailSerializer
80 
81     def get_queryset(self):
82         earliest_default, latest_default = default_membership_cutoff()
83 
84         earliest = self.request.query_params.get('earliest', None)
85         if earliest is not None:
86             try:
87                 earliest = datetime.datetime.strptime(earliest, '%Y-%m-%d') \
88                                             .date()
89             except ValueError:
90                 earliest = earliest_default
91         else:
92             earliest = earliest_default
93 
94         latest = self.request.query_params.get('latest', None)
95         if latest is not None:
96             try:
97                 latest = datetime.datetime.strptime(latest, '%Y-%m-%d').date()
98             except ValueError:
99                 latest = latest_default
100         else:
101             latest = latest_default
102 
103         return get_members(earliest, latest)
104 
105     def get_query_params_description(self):
106         return {
107             'earliest': 'Date of earliest workshop someone taught at.'
108                         '  Defaults to -2*365 days from current date.',
109             'latest': 'Date of latest workshop someone taught at.'
110                       '  Defaults to current date.',
111         }
112 
113 
114 class PublishedEvents(ListAPIView):
115     """List published events."""
116 
117     # only events that have both a starting date and a URL
118     permission_classes = (IsAuthenticatedOrReadOnly, )
119     paginator = None  # disable pagination
120 
121     serializer_class = EventSerializer
122 
123     metadata_class = QueryMetadata
124 
125     def get_queryset(self):
126         """Optionally restrict the returned event set to events hosted by
127         specific host or administered by specific admin."""
128         queryset = Event.objects.published_events()
129 
130         administrator = self.request.query_params.get('administrator', None)
131         if administrator is not None:
132             queryset = queryset.filter(administrator__pk=administrator)
133 
134         host = self.request.query_params.get('host', None)
135         if host is not None:
136             queryset = queryset.filter(host__pk=host)
137 
138         tags = self.request.query_params.getlist('tag', None)
139         if tags:
140             tags = Tag.objects.filter(name__in=tags)
141             for tag in tags:
142                 queryset = queryset.filter(tags=tag)
143 
144         return queryset
145 
146     def get_query_params_description(self):
147         return {
148             'administrator': 'ID of the organization responsible for admin '
149                              'work on events.',
150             'host': 'ID of the organization hosting the event.',
151             'tag': "Events' tag(s). You can use this parameter multiple "
152                    "times.",
153         }
154 
155 
156 class UserTodoItems(ListAPIView):
157     permission_classes = (IsAuthenticated, )
158     paginator = None
159     serializer_class = TodoSerializer
160 
161     def get_queryset(self):
162         """Return current TODOs for currently logged in user."""
163         return TodoItem.objects.user(self.request.user) \
164                                .incomplete() \
165                                .exclude(due=None) \
166                                .select_related('event')
167
```
--- 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/api/serializers.py b/api/serializers.py
--- a/api/serializers.py
+++ b/api/serializers.py
@@ -12,12 +12,12 @@
         fields = ('name', 'user', )
 
 
-class PersonNameEmailSerializer(serializers.ModelSerializer):
+class PersonNameEmailUsernameSerializer(serializers.ModelSerializer):
     name = serializers.CharField(source='get_full_name')
 
     class Meta:
         model = Person
-        fields = ('name', 'email')
+        fields = ('name', 'email', 'username')
 
 
 class ExportBadgesSerializer(serializers.ModelSerializer):
diff --git a/api/views.py b/api/views.py
--- a/api/views.py
+++ b/api/views.py
@@ -14,7 +14,7 @@
 from workshops.util import get_members, default_membership_cutoff
 
 from .serializers import (
-    PersonNameEmailSerializer,
+    PersonNameEmailUsernameSerializer,
     ExportBadgesSerializer,
     ExportInstructorLocationsSerializer,
     EventSerializer,
@@ -73,10 +73,10 @@
 
 class ExportMembersView(ListAPIView):
     """Show everyone who qualifies as an SCF member."""
-    permission_classes = (IsAuthenticatedOrReadOnly, )
+    permission_classes = (IsAuthenticated, )
     paginator = None  # disable pagination
 
-    serializer_class = PersonNameEmailSerializer
+    serializer_class = PersonNameEmailUsernameSerializer
 
     def get_queryset(self):
         earliest_default, latest_default = default_membership_cutoff()

{"golden_diff": "diff --git a/api/serializers.py b/api/serializers.py\n--- a/api/serializers.py\n+++ b/api/serializers.py\n@@ -12,12 +12,12 @@\n         fields = ('name', 'user', )\n \n \n-class PersonNameEmailSerializer(serializers.ModelSerializer):\n+class PersonNameEmailUsernameSerializer(serializers.ModelSerializer):\n     name = serializers.CharField(source='get_full_name')\n \n     class Meta:\n         model = Person\n-        fields = ('name', 'email')\n+        fields = ('name', 'email', 'username')\n \n \n class ExportBadgesSerializer(serializers.ModelSerializer):\ndiff --git a/api/views.py b/api/views.py\n--- a/api/views.py\n+++ b/api/views.py\n@@ -14,7 +14,7 @@\n from workshops.util import get_members, default_membership_cutoff\n \n from .serializers import (\n-    PersonNameEmailSerializer,\n+    PersonNameEmailUsernameSerializer,\n     ExportBadgesSerializer,\n     ExportInstructorLocationsSerializer,\n     EventSerializer,\n@@ -73,10 +73,10 @@\n \n class ExportMembersView(ListAPIView):\n     \"\"\"Show everyone who qualifies as an SCF member.\"\"\"\n-    permission_classes = (IsAuthenticatedOrReadOnly, )\n+    permission_classes = (IsAuthenticated, )\n     paginator = None  # disable pagination\n \n-    serializer_class = PersonNameEmailSerializer\n+    serializer_class = PersonNameEmailUsernameSerializer\n \n     def get_queryset(self):\n         earliest_default, latest_default = default_membership_cutoff()\n", "issue": "Modify members API call so that JSON includes user ID\nRight now the 'members' API gives us name and email - the JSON should include each person's user ID as well.\n\n", "before_files": [{"content": "from rest_framework import serializers\n\nfrom workshops.models import Badge, Airport, Person, Event, TodoItem, Tag\n\n\nclass PersonUsernameSerializer(serializers.ModelSerializer):\n    name = serializers.CharField(source='get_full_name')\n    user = serializers.CharField(source='username')\n\n    class Meta:\n        model = Person\n        fields = ('name', 'user', )\n\n\nclass PersonNameEmailSerializer(serializers.ModelSerializer):\n    name = serializers.CharField(source='get_full_name')\n\n    class Meta:\n        model = Person\n        fields = ('name', 'email')\n\n\nclass ExportBadgesSerializer(serializers.ModelSerializer):\n    persons = PersonUsernameSerializer(many=True, source='person_set')\n\n    class Meta:\n        model = Badge\n        fields = ('name', 'persons')\n\n\nclass ExportInstructorLocationsSerializer(serializers.ModelSerializer):\n    name = serializers.CharField(source='fullname')\n    instructors = PersonUsernameSerializer(many=True, source='person_set')\n\n    class Meta:\n        model = Airport\n        fields = ('name', 'latitude', 'longitude', 'instructors', 'country')\n\n\nclass TagSerializer(serializers.ModelSerializer):\n    class Meta:\n        model = Tag\n        fields = ('name', )\n\n\nclass EventSerializer(serializers.ModelSerializer):\n    humandate = serializers.CharField(source='human_readable_date')\n    country = serializers.CharField()\n    start = serializers.DateField(format=None)\n    end = serializers.DateField(format=None)\n    url = serializers.URLField(source='website_url')\n    eventbrite_id = serializers.CharField(source='reg_key')\n    tags = TagSerializer(many=True)\n\n    class Meta:\n        model = Event\n        fields = (\n            'slug', 'start', 'end', 'url', 'humandate', 'contact', 'country',\n            'venue', 'address', 'latitude', 'longitude', 'eventbrite_id',\n            'tags',\n        )\n\n\nclass TodoSerializer(serializers.ModelSerializer):\n    content = serializers.SerializerMethodField()\n    start = serializers.DateField(format=None, source='due')\n\n    class Meta:\n        model = TodoItem\n        fields = (\n            'content', 'start',\n        )\n\n    def get_content(self, obj):\n        \"\"\"Return HTML containing interesting information for admins.  This\n        will be displayed on labels in the timeline.\"\"\"\n\n        return '<a href=\"{url}\">{event}</a><br><small>{todo}</small>'.format(\n            url=obj.event.get_absolute_url(),\n            event=obj.event.get_ident(),\n            todo=obj.title,\n        )\n", "path": "api/serializers.py"}, {"content": "import datetime\n\nfrom django.db.models import Q\nfrom rest_framework.generics import ListAPIView\nfrom rest_framework.metadata import SimpleMetadata\nfrom rest_framework.permissions import (\n    IsAuthenticatedOrReadOnly, IsAuthenticated\n)\nfrom rest_framework.response import Response\nfrom rest_framework.reverse import reverse\nfrom rest_framework.views import APIView\n\nfrom workshops.models import Badge, Airport, Event, TodoItem, Tag\nfrom workshops.util import get_members, default_membership_cutoff\n\nfrom .serializers import (\n    PersonNameEmailSerializer,\n    ExportBadgesSerializer,\n    ExportInstructorLocationsSerializer,\n    EventSerializer,\n    TodoSerializer,\n)\n\n\nclass QueryMetadata(SimpleMetadata):\n    \"\"\"Additionally include info about query parameters.\"\"\"\n\n    def determine_metadata(self, request, view):\n        data = super().determine_metadata(request, view)\n\n        try:\n            data['query_params'] = view.get_query_params_description()\n        except AttributeError:\n            pass\n\n        return data\n\n\nclass ApiRoot(APIView):\n    def get(self, request, format=None):\n        return Response({\n            'export-badges': reverse('api:export-badges', request=request,\n                                     format=format),\n            'export-instructors': reverse('api:export-instructors',\n                                          request=request, format=format),\n            'export-members': reverse('api:export-members', request=request,\n                                      format=format),\n            'events-published': reverse('api:events-published',\n                                        request=request, format=format),\n            'user-todos': reverse('api:user-todos',\n                                  request=request, format=format),\n        })\n\n\nclass ExportBadgesView(ListAPIView):\n    \"\"\"List all badges and people who have them.\"\"\"\n    permission_classes = (IsAuthenticatedOrReadOnly, )\n    paginator = None  # disable pagination\n\n    queryset = Badge.objects.prefetch_related('person_set')\n    serializer_class = ExportBadgesSerializer\n\n\nclass ExportInstructorLocationsView(ListAPIView):\n    \"\"\"List all airports and instructors located near them.\"\"\"\n    permission_classes = (IsAuthenticatedOrReadOnly, )\n    paginator = None  # disable pagination\n\n    queryset = Airport.objects.exclude(person=None) \\\n                              .prefetch_related('person_set')\n    serializer_class = ExportInstructorLocationsSerializer\n\n\nclass ExportMembersView(ListAPIView):\n    \"\"\"Show everyone who qualifies as an SCF member.\"\"\"\n    permission_classes = (IsAuthenticatedOrReadOnly, )\n    paginator = None  # disable pagination\n\n    serializer_class = PersonNameEmailSerializer\n\n    def get_queryset(self):\n        earliest_default, latest_default = default_membership_cutoff()\n\n        earliest = self.request.query_params.get('earliest', None)\n        if earliest is not None:\n            try:\n                earliest = datetime.datetime.strptime(earliest, '%Y-%m-%d') \\\n                                            .date()\n            except ValueError:\n                earliest = earliest_default\n        else:\n            earliest = earliest_default\n\n        latest = self.request.query_params.get('latest', None)\n        if latest is not None:\n            try:\n                latest = datetime.datetime.strptime(latest, '%Y-%m-%d').date()\n            except ValueError:\n                latest = latest_default\n        else:\n            latest = latest_default\n\n        return get_members(earliest, latest)\n\n    def get_query_params_description(self):\n        return {\n            'earliest': 'Date of earliest workshop someone taught at.'\n                        '  Defaults to -2*365 days from current date.',\n            'latest': 'Date of latest workshop someone taught at.'\n                      '  Defaults to current date.',\n        }\n\n\nclass PublishedEvents(ListAPIView):\n    \"\"\"List published events.\"\"\"\n\n    # only events that have both a starting date and a URL\n    permission_classes = (IsAuthenticatedOrReadOnly, )\n    paginator = None  # disable pagination\n\n    serializer_class = EventSerializer\n\n    metadata_class = QueryMetadata\n\n    def get_queryset(self):\n        \"\"\"Optionally restrict the returned event set to events hosted by\n        specific host or administered by specific admin.\"\"\"\n        queryset = Event.objects.published_events()\n\n        administrator = self.request.query_params.get('administrator', None)\n        if administrator is not None:\n            queryset = queryset.filter(administrator__pk=administrator)\n\n        host = self.request.query_params.get('host', None)\n        if host is not None:\n            queryset = queryset.filter(host__pk=host)\n\n        tags = self.request.query_params.getlist('tag', None)\n        if tags:\n            tags = Tag.objects.filter(name__in=tags)\n            for tag in tags:\n                queryset = queryset.filter(tags=tag)\n\n        return queryset\n\n    def get_query_params_description(self):\n        return {\n            'administrator': 'ID of the organization responsible for admin '\n                             'work on events.',\n            'host': 'ID of the organization hosting the event.',\n            'tag': \"Events' tag(s). You can use this parameter multiple \"\n                   \"times.\",\n        }\n\n\nclass UserTodoItems(ListAPIView):\n    permission_classes = (IsAuthenticated, )\n    paginator = None\n    serializer_class = TodoSerializer\n\n    def get_queryset(self):\n        \"\"\"Return current TODOs for currently logged in user.\"\"\"\n        return TodoItem.objects.user(self.request.user) \\\n                               .incomplete() \\\n                               .exclude(due=None) \\\n                               .select_related('event')\n", "path": "api/views.py"}], "after_files": [{"content": "from rest_framework import serializers\n\nfrom workshops.models import Badge, Airport, Person, Event, TodoItem, Tag\n\n\nclass PersonUsernameSerializer(serializers.ModelSerializer):\n    name = serializers.CharField(source='get_full_name')\n    user = serializers.CharField(source='username')\n\n    class Meta:\n        model = Person\n        fields = ('name', 'user', )\n\n\nclass PersonNameEmailUsernameSerializer(serializers.ModelSerializer):\n    name = serializers.CharField(source='get_full_name')\n\n    class Meta:\n        model = Person\n        fields = ('name', 'email', 'username')\n\n\nclass ExportBadgesSerializer(serializers.ModelSerializer):\n    persons = PersonUsernameSerializer(many=True, source='person_set')\n\n    class Meta:\n        model = Badge\n        fields = ('name', 'persons')\n\n\nclass ExportInstructorLocationsSerializer(serializers.ModelSerializer):\n    name = serializers.CharField(source='fullname')\n    instructors = PersonUsernameSerializer(many=True, source='person_set')\n\n    class Meta:\n        model = Airport\n        fields = ('name', 'latitude', 'longitude', 'instructors', 'country')\n\n\nclass TagSerializer(serializers.ModelSerializer):\n    class Meta:\n        model = Tag\n        fields = ('name', )\n\n\nclass EventSerializer(serializers.ModelSerializer):\n    humandate = serializers.CharField(source='human_readable_date')\n    country = serializers.CharField()\n    start = serializers.DateField(format=None)\n    end = serializers.DateField(format=None)\n    url = serializers.URLField(source='website_url')\n    eventbrite_id = serializers.CharField(source='reg_key')\n    tags = TagSerializer(many=True)\n\n    class Meta:\n        model = Event\n        fields = (\n            'slug', 'start', 'end', 'url', 'humandate', 'contact', 'country',\n            'venue', 'address', 'latitude', 'longitude', 'eventbrite_id',\n            'tags',\n        )\n\n\nclass TodoSerializer(serializers.ModelSerializer):\n    content = serializers.SerializerMethodField()\n    start = serializers.DateField(format=None, source='due')\n\n    class Meta:\n        model = TodoItem\n        fields = (\n            'content', 'start',\n        )\n\n    def get_content(self, obj):\n        \"\"\"Return HTML containing interesting information for admins.  This\n        will be displayed on labels in the timeline.\"\"\"\n\n        return '<a href=\"{url}\">{event}</a><br><small>{todo}</small>'.format(\n            url=obj.event.get_absolute_url(),\n            event=obj.event.get_ident(),\n            todo=obj.title,\n        )\n", "path": "api/serializers.py"}, {"content": "import datetime\n\nfrom django.db.models import Q\nfrom rest_framework.generics import ListAPIView\nfrom rest_framework.metadata import SimpleMetadata\nfrom rest_framework.permissions import (\n    IsAuthenticatedOrReadOnly, IsAuthenticated\n)\nfrom rest_framework.response import Response\nfrom rest_framework.reverse import reverse\nfrom rest_framework.views import APIView\n\nfrom workshops.models import Badge, Airport, Event, TodoItem, Tag\nfrom workshops.util import get_members, default_membership_cutoff\n\nfrom .serializers import (\n    PersonNameEmailUsernameSerializer,\n    ExportBadgesSerializer,\n    ExportInstructorLocationsSerializer,\n    EventSerializer,\n    TodoSerializer,\n)\n\n\nclass QueryMetadata(SimpleMetadata):\n    \"\"\"Additionally include info about query parameters.\"\"\"\n\n    def determine_metadata(self, request, view):\n        data = super().determine_metadata(request, view)\n\n        try:\n            data['query_params'] = view.get_query_params_description()\n        except AttributeError:\n            pass\n\n        return data\n\n\nclass ApiRoot(APIView):\n    def get(self, request, format=None):\n        return Response({\n            'export-badges': reverse('api:export-badges', request=request,\n                                     format=format),\n            'export-instructors': reverse('api:export-instructors',\n                                          request=request, format=format),\n            'export-members': reverse('api:export-members', request=request,\n                                      format=format),\n            'events-published': reverse('api:events-published',\n                                        request=request, format=format),\n            'user-todos': reverse('api:user-todos',\n                                  request=request, format=format),\n        })\n\n\nclass ExportBadgesView(ListAPIView):\n    \"\"\"List all badges and people who have them.\"\"\"\n    permission_classes = (IsAuthenticatedOrReadOnly, )\n    paginator = None  # disable pagination\n\n    queryset = Badge.objects.prefetch_related('person_set')\n    serializer_class = ExportBadgesSerializer\n\n\nclass ExportInstructorLocationsView(ListAPIView):\n    \"\"\"List all airports and instructors located near them.\"\"\"\n    permission_classes = (IsAuthenticatedOrReadOnly, )\n    paginator = None  # disable pagination\n\n    queryset = Airport.objects.exclude(person=None) \\\n                              .prefetch_related('person_set')\n    serializer_class = ExportInstructorLocationsSerializer\n\n\nclass ExportMembersView(ListAPIView):\n    \"\"\"Show everyone who qualifies as an SCF member.\"\"\"\n    permission_classes = (IsAuthenticated, )\n    paginator = None  # disable pagination\n\n    serializer_class = PersonNameEmailUsernameSerializer\n\n    def get_queryset(self):\n        earliest_default, latest_default = default_membership_cutoff()\n\n        earliest = self.request.query_params.get('earliest', None)\n        if earliest is not None:\n            try:\n                earliest = datetime.datetime.strptime(earliest, '%Y-%m-%d') \\\n                                            .date()\n            except ValueError:\n                earliest = earliest_default\n        else:\n            earliest = earliest_default\n\n        latest = self.request.query_params.get('latest', None)\n        if latest is not None:\n            try:\n                latest = datetime.datetime.strptime(latest, '%Y-%m-%d').date()\n            except ValueError:\n                latest = latest_default\n        else:\n            latest = latest_default\n\n        return get_members(earliest, latest)\n\n    def get_query_params_description(self):\n        return {\n            'earliest': 'Date of earliest workshop someone taught at.'\n                        '  Defaults to -2*365 days from current date.',\n            'latest': 'Date of latest workshop someone taught at.'\n                      '  Defaults to current date.',\n        }\n\n\nclass PublishedEvents(ListAPIView):\n    \"\"\"List published events.\"\"\"\n\n    # only events that have both a starting date and a URL\n    permission_classes = (IsAuthenticatedOrReadOnly, )\n    paginator = None  # disable pagination\n\n    serializer_class = EventSerializer\n\n    metadata_class = QueryMetadata\n\n    def get_queryset(self):\n        \"\"\"Optionally restrict the returned event set to events hosted by\n        specific host or administered by specific admin.\"\"\"\n        queryset = Event.objects.published_events()\n\n        administrator = self.request.query_params.get('administrator', None)\n        if administrator is not None:\n            queryset = queryset.filter(administrator__pk=administrator)\n\n        host = self.request.query_params.get('host', None)\n        if host is not None:\n            queryset = queryset.filter(host__pk=host)\n\n        tags = self.request.query_params.getlist('tag', None)\n        if tags:\n            tags = Tag.objects.filter(name__in=tags)\n            for tag in tags:\n                queryset = queryset.filter(tags=tag)\n\n        return queryset\n\n    def get_query_params_description(self):\n        return {\n            'administrator': 'ID of the organization responsible for admin '\n                             'work on events.',\n            'host': 'ID of the organization hosting the event.',\n            'tag': \"Events' tag(s). You can use this parameter multiple \"\n                   \"times.\",\n        }\n\n\nclass UserTodoItems(ListAPIView):\n    permission_classes = (IsAuthenticated, )\n    paginator = None\n    serializer_class = TodoSerializer\n\n    def get_queryset(self):\n        \"\"\"Return current TODOs for currently logged in user.\"\"\"\n        return TodoItem.objects.user(self.request.user) \\\n                               .incomplete() \\\n                               .exclude(due=None) \\\n                               .select_related('event')\n", "path": "api/views.py"}]}