title: How to handle database exceptions in Django
body: <p>I want to known the best way to handle database exceptions and display messages back to the user. I have been looking at <code>messages.add_message</code> in my views using a try. </p>
  
  <p>For example:</p>
  
  <p>The following error <code>(1062, "Duplicate entry '123321' for key 'PRIMARY'")</code>. Display back to the user friendly message: <code>"Error uploading CSV Duplicate entries"</code></p>
  
  <ol>
  <li><p>Is the the recommended way? </p></li>
  <li><p>Are there any good tutorials on error handling (i.e. blog posts) that you would recommend as a good approach?</p></li>
  </ol>