#NEWLINE# def _get_attachments_from_instance( instance ) : #NEWLINE# #INDENT# attachments = [ ] #NEWLINE# for a in instance . attachments . all ( ) : #NEWLINE# #INDENT# attachment = dict ( ) #NEWLINE# attachment [ 'download_url' ] = a . media_file . url #NEWLINE# attachment [ 'mimetype' ] = a . mimetype #NEWLINE# attachment [ 'filename' ] = a . media_file . name #NEWLINE# attachment [ 'instance' ] = a . instance . pk #NEWLINE# attachment [ 'xform' ] = instance . xform . id #NEWLINE# attachment [ 'id' ] = a . id #NEWLINE# attachments . append ( attachment ) #NEWLINE# #UNINDENT# return attachments