How to render the error message of the Django database in the foreground

I used Django to build a platform for storing data. The amount of data is small, but there are many tables, so the background is the default sqlite
when establishing a model, some fields are defined as unique. I hope that in the uploaded file, if there is a record that already exists in this field, Just prompt an error message
is there a way to feed back the word "UNIQUE constraint failed" in the unique check error page that comes with Django directly to the foreground? Or do you have to write judgment logic separately in view?
Thank you

Apr.14,2021

Business logic should be written in view.
but you can write it as mixin.

Menu