diff options
author | 2019-10-04 08:13:18 +0200 | |
---|---|---|
committer | 2019-10-07 12:46:19 +0200 | |
commit | ec2ae9d1ef38d44cfeeb4abbe3bda035afe93e2b (patch) | |
tree | 74d8308acb52e3f6701bc54d5e655c20c4533db4 /pydis_site/apps/api/views.py | |
parent | disable usage of pyuwsgi on windows due to incompatibility, library is only u... (diff) |
Add validation rules to Infraction serializer
https://github.com/python-discord/site/issues/273
This commit adds validation rules to the Infraction serializer that
validate if a given infraction should be accepted based on its status
of being considered `active`. If the validation fails, the API will
reject the request and return a 400 status.
Specifically, this validator checks that:
- infractions that can never be active do not have `active=True` set;
- a user can never receive a second active infraction of the same type.
Tests have been added to `test_infractions.py` to ensure that the
validators work as expected.
This commit implements the first part of #273
Diffstat (limited to 'pydis_site/apps/api/views.py')
0 files changed, 0 insertions, 0 deletions