=== django/newforms/formsets.py ================================================================== --- django/newforms/formsets.py (revision 448) +++ django/newforms/formsets.py (patch d5628_fix level 1) @@ -87,7 +87,7 @@ change_form = FormClass(**kwargs) self.add_fields(change_form, i) change_forms.append(change_form) - self._change_forms= change_forms + self._change_forms = change_forms return self._change_forms change_forms = property(_get_change_forms) === django/contrib/admin/options.py ================================================================== --- django/contrib/admin/options.py (revision 448) +++ django/contrib/admin/options.py (patch d5628_fix level 1) @@ -521,7 +521,7 @@ 'is_popup': request.REQUEST.has_key('_popup'), 'show_delete': False, 'media': media, - 'inline_admin_formsets': inline_admin_formsets, + 'inline_admin_formsets': InlineAdminFormSetList(inline_admin_formsets), }) return self.render_change_form(model, c, add=True) @@ -596,7 +596,7 @@ 'original': obj, 'is_popup': request.REQUEST.has_key('_popup'), 'media': media, - 'inline_admin_formsets': inline_admin_formsets, + 'inline_admin_formsets': InlineAdminFormSetList(inline_admin_formsets), }) return self.render_change_form(model, c, change=True) @@ -766,6 +766,26 @@ class TabularInline(InlineModelAdmin): template = 'admin/edit_inline/tabular.html' +class InlineAdminFormSetList(object): + def __init__(self, admin_formsets): + self.admin_formsets = admin_formsets + self.formsets = [ifs.formset for ifs in admin_formsets] + + def __iter__(self): + return iter(self.admin_formsets) + + def _get_errors(self): + errors = [] + for formset in self.formsets: + # HACK: a FormSet object does not always have an errors attribute. + # this will work without the hasattr check for errors since its only + # usage is in the template and variable resolution will suppress the + # AttributeError exception thrown. + if hasattr(formset, 'errors'): + errors.append(formset.errors) + return bool(errors) + errors = property(_get_errors) + class InlineAdminFormSet(object): """ A wrapper around an inline formset for use in the admin system. === django/contrib/admin/templates/admin/change_form.html ================================================================== --- django/contrib/admin/templates/admin/change_form.html (revision 448) +++ django/contrib/admin/templates/admin/change_form.html (patch d5628_fix level 1) @@ -34,7 +34,7 @@
{% blocktrans count adminform.form.errors.items|length as counter %}Please correct the error below.{% plural %}Please correct the errors below.{% endblocktrans %}