#NEWLINE# def prepare_file( self , field ) : #NEWLINE# #INDENT# field_attrs = field . build_field_attrs ( ) #NEWLINE# widget_attrs = field . build_widget_attrs ( ) #NEWLINE# field_attrs . update ( { #NEWLINE# #INDENT# 'widget' : forms . ClearableFileInput ( attrs = widget_attrs ) , #NEWLINE# #UNINDENT# } ) #NEWLINE# if field . choice_values : #NEWLINE# #INDENT# regex = re . compile ( '[\\s]*\n[\\s]*' ) #NEWLINE# choices = regex . split ( choices . choice_values ) #NEWLINE# field_attrs . update ( { #NEWLINE# #INDENT# 'allowed_file_types' : [ i . lstrip ( '.' ) . lower ( ) for i in choices ] , #NEWLINE# #UNINDENT# } ) #NEWLINE# #UNINDENT# return FormBuilderFileField ( ** field_attrs )