Skip to content

Commit

Permalink
[fix] ignore objects with no file
Browse files Browse the repository at this point in the history
  • Loading branch information
Chive committed Jul 15, 2014
1 parent 1514295 commit 9f1bb09
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions multiupload/fields.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,9 @@ def __init__(self, *args, **kwargs):
def to_python(self, data):
ret = []
for item in data:
ret.append(super(MultiFileField, self).to_python(item))
i = super(MultiFileField, self).to_python(item)
if i:
ret.append(i)
return ret

def validate(self, data):
Expand All @@ -47,4 +49,6 @@ def validate(self, data):
raise ValidationError(self.error_messages['max_num'] % {'max_num': self.max_num, 'num_files': num_files})
for uploaded_file in data:
if uploaded_file.size > self.maximum_file_size:
raise ValidationError(self.error_messages['file_size'] % { 'uploaded_file_name': uploaded_file.name})
raise ValidationError(self.error_messages['file_size'] % {'uploaded_file_name': uploaded_file.name})


0 comments on commit 9f1bb09

Please sign in to comment.