Skip to content

Commit

Permalink
Fix: Collection.cleaned_data prematurely returned values
Browse files Browse the repository at this point in the history
  • Loading branch information
jrief committed May 28, 2024
1 parent 4f929c5 commit c732f3d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion formset/collection.py
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,7 @@ def cleaned_data(self):
"""
Return the cleaned data for this collection and nested forms/collections.
"""
if not self.is_valid():
if self._errors is None or not self.is_valid():
raise AttributeError(f"'{self.__class__}' object has no attribute 'cleaned_data'")
if self.has_many:
return [{name: holder.cleaned_data} for valid_holders in self.valid_holders for name, holder in valid_holders.items()]
Expand Down

0 comments on commit c732f3d

Please sign in to comment.