File tree Expand file tree Collapse file tree 1 file changed +4
-6
lines changed Expand file tree Collapse file tree 1 file changed +4
-6
lines changed Original file line number Diff line number Diff line change 1
1
"""Converters from Django models to data interchange formats and back."""
2
- from typing import List
3
-
4
2
from django .db .models .query import QuerySet
5
3
from django .db .utils import IntegrityError
6
4
from rest_framework .exceptions import NotFound
@@ -205,12 +203,12 @@ def to_representation(self, instance: Infraction) -> dict:
205
203
class OffTopicChannelNameListSerializer (ListSerializer ):
206
204
"""Custom ListSerializer to override to_representation() when list views are triggered."""
207
205
208
- def to_representation (self , objects : List [OffTopicChannelName ]) -> List [str ]:
206
+ def to_representation (self , objects : list [OffTopicChannelName ]) -> list [str ]:
209
207
"""
210
- Return a list representing a list of `OffTopicChannelName`.
208
+ Return a list with all `OffTopicChannelName`s in the database .
211
209
212
- This only returns the name of the off topic channel name. As the model
213
- only has a single attribute, it is unnecessary to create a nested dictionary.
210
+ This returns the list of off topic channel names. We want to only return
211
+ the name attribute, hence it is unnecessary to create a nested dictionary.
214
212
Additionally, this allows off topic channel name routes to simply return an
215
213
array of names instead of objects, saving on bandwidth.
216
214
"""
You can’t perform that action at this time.
0 commit comments