Describe the bug
a patch/post to substances that attempts to use an associated_compound that has already been assigned to a substance, the serializer is validating, but the save method throws a 500 server error at the moment
To Reproduce
Steps to reproduce the behavior:
Go to 'Postman'
make a POST or PATCH to substances where the associatedCompound is already linked to a substance
See error
Expected behavior
The errror coming from the OneToOne field validation should be returned in a 400 response
Additional context
There is a branch(unique-compound-error) that illustrates in tests the problem that we are having with a patch/post to substances that attempts to use an associated_compound that has already been assigned to a substance, the serializer is validating, but the save method throws an error at the moment which you can see in the test_serializers test I've added if you...
Describe the bug a patch/post to substances that attempts to use an associated_compound that has already been assigned to a substance, the serializer is validating, but the save method throws a 500 server error at the moment
To Reproduce Steps to reproduce the behavior:
associatedCompound
is already linked to a substanceExpected behavior The errror coming from the OneToOne field validation should be returned in a 400 response
Additional context
There is a branch(
unique-compound-error
) that illustrates in tests the problem that we are having with a patch/post to substances that attempts to use an associated_compound that has already been assigned to a substance, the serializer is validating, but the save method throws an error at the moment which you can see in the test_serializers test I've added if you...pytest --pdb chemreg/substance/tests/test_serializers.py::test_substance_unique_compound
and try the following is_valid() and save() methods in the debugger. Here's what the runserver kicks back
but in Postman when we try to patch/post witha compound that is already connected to a substance, we are getting...