Chemical-Curation / chemcurator_django

Backend services for chemical curation
https://api.chemreg.epa.gov
MIT License
1 stars 0 forks source link

exclude instance in restricted synonym queryset #243

Closed debboutr closed 3 years ago

debboutr commented 4 years ago

I added the collection folder that @michael-barbour attached to the issue in this branch and added an exclude filter in the synonyms to lookup if there is an instance when doing validation. ~Just need to make out a test when the ticket gets pointed and we should be good to go.~

The problem here was that if a synonym is created with a synonymQuality that is_restrictive and then the user were to make a patch to set another is_restrictive synonymQuality to that same synonym the validation would find the same synonym.identifier and throw an error saying that

The identifier '{identifier}' is not unique in restrictive name fields.

even though it is the same instance that is causing the validation error. This is expressed in the test