#26655: Provide a hook to handle database exceptions in Django Admin
-------------------------------+--------------------
     Reporter:  nickretallack  |      Owner:  nobody
         Type:  Bug            |     Status:  new
    Component:  contrib.admin  |    Version:  master
     Severity:  Normal         |   Keywords:
 Triage Stage:  Unreviewed     |  Has patch:  1
Easy pickings:  0              |      UI/UX:  0
-------------------------------+--------------------
 Steps to reproduce:
  * Create a database model with a unique constraint
  * Create a record in the django admin
  * Create another record with the same value in that field.

 The result is an unhandled database exception.  It would be better if the
 exception was handled and reported as an error on the form.  Here is a
 simple patch that demonstrates how you could do this.

 
[https://github.com/nickretallack/django/commit/9353970aa0f169e44175a155a4a9e69daf8bda18]

 This method could be overridden to attach the error to the form in a more
 specific way, for example by introspecting the error's diagnostic
 information from the database to determine what the problem was and which
 form field it should be attached to.

--
Ticket URL: <https://code.djangoproject.com/ticket/26655>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/056.31c70729fbc30112609492fe1bcd3155%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to