Skip to content

Commit

Permalink
Merge pull request #2 from marcinn/master
Browse files Browse the repository at this point in the history
fix for issue #1
  • Loading branch information
t0ster committed Dec 20, 2011
2 parents 4f684ac + 7356f00 commit 0536161
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions composite_form/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@ def __init__(self, data=None, files=None, *args, **initkwargs):
raise ValueError("instances should be a list the same lenth as form_list")
if len(instances) != len(self.form_list):
raise ValueError("instances should be a list the same lenth as form_list")
kwargs = initkwargs.copy()
self.is_bound = data is not None or files is not None
self.instances = instances

for form in self.form_list:
kwargs = initkwargs.copy()
if self.get_form_instance(form):
kwargs.update({"instance": self.get_form_instance(form)})
self._form_instances[form] = form(data, files, *args, **kwargs)
Expand Down Expand Up @@ -88,12 +88,18 @@ def initial(self):
_initial.update(form.initial)
return _initial

def non_field_errors(self):
_errors = forms.util.ErrorList()
for form in self.forms:
_errors.extend(form.non_field_errors())
return _errors

@property
def errors(self):
"""
Returns error dictionary containing all errors from all forms
"""
_errors = {}
_errors = forms.util.ErrorDict()
for form in self.forms:
_errors.update(form.errors)

Expand Down

0 comments on commit 0536161

Please sign in to comment.