mattiaslinnap / django-partial-index

PostgreSQL and SQLite partial index support for Django
BSD 3-Clause "New" or "Revised" License
116 stars 12 forks source link

User-friendly error messages for ModelForms #4

Closed mattiaslinnap closed 6 years ago

mattiaslinnap commented 7 years ago

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.

Bartvds commented 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.

mattiaslinnap commented 6 years ago

Now part of the v0.5 release.