Skip to content

Commit 64ce376

Browse files
committed
Wrong exception class in except
1 parent ea6c6bc commit 64ce376

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

rest_framework_json_api/relations.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
from rest_framework.exceptions import ValidationError
12
from rest_framework.relations import *
23

34

@@ -13,8 +14,9 @@ def __init__(self, **kwargs):
1314

1415
def to_internal_value(self, data):
1516
try:
17+
# Try parsing links first for the browseable API
1618
return super(HyperlinkedRelatedField, self).to_internal_value(data)
17-
except AssertionError:
19+
except ValidationError:
1820
if self.pk_field is not None:
1921
data = self.pk_field.to_internal_value(data)
2022
try:

0 commit comments

Comments
 (0)