diff options
| author | 2021-02-22 09:37:12 +0200 | |
|---|---|---|
| committer | 2021-02-22 09:37:12 +0200 | |
| commit | 698cbc17405a49fe42669fedd6054ab6c9008a4a (patch) | |
| tree | d8160f7f6d81c877af25a2394367cec7fe05ead0 | |
| parent | Add rollback to nominations table split migration (diff) | |
Wrap validation errors to []
| -rw-r--r-- | pydis_site/apps/api/viewsets/bot/nomination.py | 10 | 
1 files changed, 5 insertions, 5 deletions
| diff --git a/pydis_site/apps/api/viewsets/bot/nomination.py b/pydis_site/apps/api/viewsets/bot/nomination.py index 81fb43f7..c4600425 100644 --- a/pydis_site/apps/api/viewsets/bot/nomination.py +++ b/pydis_site/apps/api/viewsets/bot/nomination.py @@ -259,7 +259,7 @@ class NominationViewSet(CreateModelMixin, RetrieveModelMixin, ListModelMixin, Ge                  actor__id=entry_serializer.validated_data["actor"].id          ).exists():              raise ValidationError( -                {'actor': 'This actor have already created nomination entry for this nomination.'} +                {'actor': ['This actor have already created nomination entry for this nomination.']}              )          NominationEntry.objects.create(**entry_serializer.validated_data) @@ -301,12 +301,12 @@ class NominationViewSet(CreateModelMixin, RetrieveModelMixin, ListModelMixin, Ge              # 2. We're setting nomination reviewed              if not instance.active:                  raise ValidationError( -                    {'reviewed': 'This field cannot be set if nomination is inactive.'} +                    {'reviewed': ['This field cannot be set if nomination is inactive.']}                  )              if 'active' in data:                  raise ValidationError( -                    {'active': 'This field cannot be set same time than ending nomination.'} +                    {'active': ['This field cannot be set same time than ending nomination.']}                  )          elif instance.active and not data['active']: @@ -332,7 +332,7 @@ class NominationViewSet(CreateModelMixin, RetrieveModelMixin, ListModelMixin, Ge          if 'reason' in request.data:              if 'actor' not in request.data:                  raise ValidationError( -                    {'actor': 'This field is required when editing reason.'} +                    {'actor': ['This field is required when editing reason.']}                  )              entry_filter = NominationEntry.objects.filter( @@ -342,7 +342,7 @@ class NominationViewSet(CreateModelMixin, RetrieveModelMixin, ListModelMixin, Ge              if not entry_filter.exists():                  raise ValidationError( -                    {'actor': "Actor don't exist or have not nominated user."} +                    {'actor': ["Actor don't exist or have not nominated user."]}                  )              entry = entry_filter[0] | 
