Changeset 7878
- Timestamp:
- 07/10/08 15:24:46 (5 months ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
django/branches/newforms-admin/django/contrib/admin/options.py
r7875 r7878 540 540 'media': mark_safe(media), 541 541 'inline_admin_formsets': inline_admin_formsets, 542 'errors': AdminErrorList(form, inline_formsets), 542 543 'root_path': self.admin_site.root_path, 543 544 } … … 617 618 'media': mark_safe(media), 618 619 'inline_admin_formsets': inline_admin_formsets, 620 'errors': AdminErrorList(form, inline_formsets), 619 621 'root_path': self.admin_site.root_path, 620 622 } … … 825 827 from django.newforms.formsets import ORDERING_FIELD_NAME 826 828 return AdminField(self.form, ORDERING_FIELD_NAME, False) 829 830 class AdminErrorList(forms.util.ErrorList): 831 """ 832 Stores all errors for the form/formsets in an add/change stage view. 833 """ 834 def __init__(self, form, inline_formsets): 835 if form.is_bound: 836 self.extend(form.errors.values()) 837 for inline_formset in inline_formsets: 838 self.extend(inline_formset.non_form_errors()) 839 for errors_in_inline_form in inline_formset.errors: 840 self.extend(errors_in_inline_form.values()) django/branches/newforms-admin/django/contrib/admin/templates/admin/change_form.html
r7638 r7878 33 33 {% if is_popup %}<input type="hidden" name="_popup" value="1" />{% endif %} 34 34 {% if save_on_top %}{% submit_row %}{% endif %} 35 {% if adminform.form.errors %}35 {% if errors %} 36 36 <p class="errornote"> 37 {% blocktrans count adminform.form.errors.items|length as counter %}Please correct the error below.{% plural %}Please correct the errors below.{% endblocktrans %}37 {% blocktrans count errors.items|length as counter %}Please correct the error below.{% plural %}Please correct the errors below.{% endblocktrans %} 38 38 </p> 39 39 <ul class="errorlist">{% for error in adminform.form.non_field_errors %}<li>{{ error }}</li>{% endfor %}</ul>
