diff options
author | 2021-12-09 20:53:49 +0100 | |
---|---|---|
committer | 2021-12-18 18:02:12 +0100 | |
commit | 3e8f164525bdd3a728bb7383da237feb9aacb44e (patch) | |
tree | fb86c93de377bb200d036b609f464b0fc2b574da /pydis_site/apps/api/serializers.py | |
parent | Adjust FilterList Representation (diff) |
Adjust FilterList Schema to group settings into subcategories
- This commit patches the FilterList serializer's schema, and puts the settings into the relevant subcategories.
Diffstat (limited to 'pydis_site/apps/api/serializers.py')
-rw-r--r-- | pydis_site/apps/api/serializers.py | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/pydis_site/apps/api/serializers.py b/pydis_site/apps/api/serializers.py index 267cf761..89005a9b 100644 --- a/pydis_site/apps/api/serializers.py +++ b/pydis_site/apps/api/serializers.py @@ -269,7 +269,14 @@ class FilterListSerializer(ModelSerializer): That does not affect how the Serializer works in general. """ ret = super().to_representation(instance) - ret["settings"] = {name: getattr(instance, name) for name in SETTINGS_FIELDS} + schema_base = {name: getattr(instance, name) for name in BASE_SETTINGS_FIELDS} + schema_settings = { + "infraction": + {name: getattr(instance, name) for name in INFRACTION_FIELDS}} \ + | { + "channel_scope": + {name: getattr(instance, name) for name in CHANNEL_SCOPE_FIELDS}} + ret["settings"] = schema_base | schema_settings return ret |