aboutsummaryrefslogtreecommitdiffstats
path: root/pydis_site/apps/api/serializers.py
diff options
context:
space:
mode:
authorGravatar RohanJnr <[email protected]>2021-06-10 02:08:54 +0530
committerGravatar RohanJnr <[email protected]>2021-06-10 02:08:54 +0530
commitda1056f36f77d98783b8fb53152fd4ebbc19c019 (patch)
tree94400c5d8c20a01f8fc12b24ab7e6c01a5968f67 /pydis_site/apps/api/serializers.py
parentQuery off topic names based on Active attribute. (diff)
Lint file and remove update() method declaration from OffTopicChannelNameListSerializer.
Diffstat (limited to 'pydis_site/apps/api/serializers.py')
-rw-r--r--pydis_site/apps/api/serializers.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/pydis_site/apps/api/serializers.py b/pydis_site/apps/api/serializers.py
index 1acb4fb8..0d505675 100644
--- a/pydis_site/apps/api/serializers.py
+++ b/pydis_site/apps/api/serializers.py
@@ -203,12 +203,12 @@ class ExpandedInfractionSerializer(InfractionSerializer):
class OffTopicChannelNameListSerializer(ListSerializer):
- def update(self, instance, validated_data):
- pass
+ """Custom ListSerializer to override to_representation() when list views are triggered."""
def to_representation(self, objects: List[OffTopicChannelName]) -> List[str]:
"""
Return the representation of this `OffTopicChannelName`.
+
This only returns the name of the off topic channel name. As the model
only has a single attribute, it is unnecessary to create a nested dictionary.
Additionally, this allows off topic channel name routes to simply return an
@@ -222,6 +222,7 @@ class OffTopicChannelNameSerializer(ModelSerializer):
class Meta:
"""Metadata defined for the Django REST Framework."""
+
list_serializer_class = OffTopicChannelNameListSerializer
model = OffTopicChannelName
fields = ('name', 'used', 'active')