From 2b0b5e83d7509f5481965b5d8b6f64d61d5828f8 Mon Sep 17 00:00:00 2001 From: Tore Brede <Tore.Brede@uib.no> Date: Tue, 27 Jul 2021 15:24:27 +0200 Subject: [PATCH] GREG-5: Switching exception type to avoid problem with mypy --- greg/api/views/person.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/greg/api/views/person.py b/greg/api/views/person.py index c856392b..c096844d 100644 --- a/greg/api/views/person.py +++ b/greg/api/views/person.py @@ -1,4 +1,4 @@ -from django.core.exceptions import BadRequest +from django.core.exceptions import ValidationError from django_filters import rest_framework as filters from rest_framework import viewsets @@ -45,6 +45,6 @@ class PersonRoleViewSet(viewsets.ModelViewSet): if person_id is None: # Should not happen, the person ID is part of the API path - raise BadRequest("No person id") + raise ValidationError("No person id") serializer.save(person_id=person_id) -- GitLab