ephios icon indicating copy to clipboard operation
ephios copied to clipboard

unique_together constraint violated with QualificationGrant formset in UserProfileForm

Open jeriox opened this issue 4 years ago • 0 comments

After introducing a unique_together constraint for users and qualifications on QualificationGrant in #210 there is the following bug:

Assuming a user has the qualification A and you load the form for this user, you can remove qualification A. Before saving, add a new qualification and select A. If you save the form now, it will have an error because the unique_together constraint is violated because the user already has the qualification A.

This could be solved by deferrable constraints, but they are only supported on postgres. We could also write our own validation logic instead of using the database constraint

jeriox avatar Jan 04 '21 21:01 jeriox