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.

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1ea22d6-1bb6.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1ea22d6-1bb6.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?