def create_attachments(note, formset):
 errors = []
 for form in formset:
  if (not form.is_valid()):
   errors.append(form.errors)
   continue
  data = form.cleaned_data
  if (not data):
   continue
  attachment = data['attachment']
  attachment_name = _save_attachment(attachment, ('%s/%s' % (settings.REVIEWER_ATTACHMENTS_PATH, attachment.name)))
  note.attachments.create(description=data.get('description'), filepath=attachment_name, mimetype=attachment.content_type)
 return errors

def create_attachments ( note , formset ) : errors = [ ] for form in formset : if ( not form . is_valid ( ) ) : errors . append ( form . errors ) continue data = form . cleaned_data if ( not data ) : continue attachment = data [ 'attachment' ] attachment_name = _save_attachment ( attachment , ( '%s/%s' % ( settings . REVIEWER_ATTACHMENTS_PATH , attachment . name ) ) ) note . attachments . create ( description = data . get ( 'description' ) , filepath = attachment_name , mimetype = attachment . content_type ) return errors
create attachments from commattachmentformset onto note .