=== modified file 'django/contrib/admin/options.py'
|
|
|
522 | 522 | 'show_delete': False, |
523 | 523 | 'media': media, |
524 | 524 | 'inline_admin_formsets': inline_admin_formsets, |
| 525 | 'errors': AdminErrorList(form, inline_formsets), |
525 | 526 | }) |
526 | 527 | return self.render_change_form(model, c, add=True) |
527 | 528 | |
… |
… |
|
597 | 598 | 'is_popup': request.REQUEST.has_key('_popup'), |
598 | 599 | 'media': media, |
599 | 600 | 'inline_admin_formsets': inline_admin_formsets, |
| 601 | 'errors': AdminErrorList(form, inline_formsets), |
600 | 602 | }) |
601 | 603 | return self.render_change_form(model, c, change=True) |
602 | 604 | |
… |
… |
|
805 | 807 | def ordering_field(self): |
806 | 808 | from django.newforms.formsets import ORDERING_FIELD_NAME |
807 | 809 | return AdminField(self.form, ORDERING_FIELD_NAME, False) |
| 810 | |
| 811 | class AdminErrorList(forms.util.ErrorList): |
| 812 | |
| 813 | def __init__(self, form, inline_formsets): |
| 814 | if form.is_bound: |
| 815 | self.extend(form.errors.values()) |
| 816 | for inline_formset in inline_formsets: |
| 817 | self.extend(inline_formset.non_form_errors()) |
| 818 | for errors_in_inline_form in inline_formset.errors: |
| 819 | self.extend(errors_in_inline_form.values()) |
=== modified file 'django/contrib/admin/templates/admin/change_form.html'
|
|
|
34 | 34 | <div> |
35 | 35 | {% if is_popup %}<input type="hidden" name="_popup" value="1" />{% endif %} |
36 | 36 | {% if save_on_top %}{% submit_row %}{% endif %} |
37 | | {% if adminform.form.errors %} |
| 37 | {% if errors %} |
38 | 38 | <p class="errornote"> |
39 | | {% blocktrans count adminform.form.errors.items|length as counter %}Please correct the error below.{% plural %}Please correct the errors below.{% endblocktrans %} |
| 39 | {% blocktrans count errors|length as counter %}Please correct the error below.{% plural %}Please correct the errors below.{% endblocktrans %} |
| 40 | {{ adminform.form.non_field_errors }} |
40 | 41 | </p> |
41 | 42 | {% endif %} |
42 | 43 | |