Closed mattiaslinnap closed 6 years ago
This would be very helpful as currently the partial unique index isn't very usable with data that is edited through the admin.
If you have partial unique for a model that is managed with inline admin's and it raises Integrity/error-500 then your browser's back button won't restore the extra inline forms for new objects and you'd loose your data-entry work.
You can sort-of work around this by overriding validate_unique()
on the model and implementing a manual check but obviously this is not beautiful.
Now part of the v0.5 release.
Currently when you save data that violates a unique=True PartialIndex, the database backend will raise an IntegrityError. This can show up as a "500 Server Error" page.
If a partial unique constraint exists on a model, then ModelForms derived from it should automatically get some sort of validation with nice error messages.