#8913: Make the "must be unique" error messages in ModelForms customizable
-------------------------------------+-------------------------------------
               Reporter:             |          Owner:  leahculver
  Alexander_Nesterov                 |         Status:  new
                   Type:  New        |      Component:  Forms
  feature                            |       Severity:  Normal
              Milestone:             |       Keywords:  forms, unique,
                Version:  1.0        |  validation
             Resolution:             |      Has patch:  1
           Triage Stage:  Accepted   |    Needs tests:  0
    Needs documentation:  1          |  Easy pickings:  0
Patch needs improvement:  1          |
                  UI/UX:  0          |
-------------------------------------+-------------------------------------
Changes (by leahculver):

 * needs_better_patch:  0 => 1
 * has_patch:  0 => 1
 * needs_docs:  0 => 1


Comment:

 I've added a rough patch for this. To specify a custom error message for
 the unique contraint, you'll need to do something like this:

 {{{
 class Context(models.Model):
     name = models.CharField(error_messages={'unique': u'My custom
 message'})
 }}}

 I don't know a lot about !ModelForms vs. Forms but I can't seem to get
 this to work for plain Forms. Should this also be a Form error_message
 key?

 I'm also not sure where to put the docs since the Model error_messages
 parameter is documented but lacking specificity
 (https://docs.djangoproject.com/en/1.3/ref/models/fields/#error-messages).
 Should I make this more specific?

-- 
Ticket URL: <https://code.djangoproject.com/ticket/8913#comment:10>
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 post to this group, send email to django-updates@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.

Reply via email to