[Fixed]-Django and postgresql: Get SQLSTATE from django database Exception 25 December 2023 by thecoderscamp.com 1👍 After further research, it appears the only way to get the SQLSTATE is: exception.__cause__.pgcode 👤gtz Query parameter added to HTTP as javascript function Source:stackexchange.com