validate_unique() is not enforced during API validation #4340
Labels
status: accepted
This issue has been accepted for implementation
type: bug
A confirmed report of unexpected behavior in the application
Environment
Steps to Reproduce
Expected Behavior
The unique constraint placed on VM name, cluster, and tenant should prevent the second VM from being created. This is true in the web UI.
Observed Behavior
The API validation ignores this unique constraint because of our use of
validate_unique()
on the virtual machine model. Django's ModelForm class does account for callingvalidate_unique()
but we have implemented our own model validation in the API by way ofValidatedModelSerializer
and it does not make a call tovalidate_unique()
. We just need to callinstance.validate_unique()
afterinstance.clean()
The text was updated successfully, but these errors were encountered: