diff options
author | 2020-07-14 15:48:34 +0200 | |
---|---|---|
committer | 2020-07-14 15:48:34 +0200 | |
commit | ee743f622dd0ba6f8c0b9801b1db1d85d60fa697 (patch) | |
tree | 09e66d2d24f26b46f86349a0816ef3440e6ff360 /pydis_site/apps/api/serializers.py | |
parent | Add a mixin for adding created and updated times. (diff) |
Add the AllowList model and serializer.
This is the model which we will use for items that are either
blacklisted or whitelisted.
https://github.com/python-discord/site/issues/305
Diffstat (limited to 'pydis_site/apps/api/serializers.py')
-rw-r--r-- | pydis_site/apps/api/serializers.py | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/pydis_site/apps/api/serializers.py b/pydis_site/apps/api/serializers.py index f2d5144c..24ba0ec0 100644 --- a/pydis_site/apps/api/serializers.py +++ b/pydis_site/apps/api/serializers.py @@ -8,7 +8,7 @@ from .models import ( DocumentationLink, Infraction, LogEntry, MessageDeletionContext, Nomination, OffTopicChannelName, - OffensiveMessage, + OffensiveMessage, AllowList, Reminder, Role, Tag, User ) @@ -97,6 +97,16 @@ class DocumentationLinkSerializer(ModelSerializer): fields = ('package', 'base_url', 'inventory_url') +class AllowListSerializer(ModelSerializer): + """A class providing (de-)serialization of `AllowList` instances.""" + + class Meta: + """Metadata defined for the Django REST Framework.""" + + model = AllowList + fields = ('created_at', 'updated_at', 'type', 'allowed', 'content') + + class InfractionSerializer(ModelSerializer): """A class providing (de-)serialization of `Infraction` instances.""" |