#NEWLINE# def create_model( self , form ) : #NEWLINE# #INDENT# '\n            Create model helper\n\n            :param form:\n                Form instance\n        ' #NEWLINE# try : #NEWLINE# #INDENT# model = form . data #NEWLINE# self . _on_model_change ( form , model , True ) #NEWLINE# self . coll . insert ( model ) #NEWLINE# #UNINDENT# except Exception as ex : #NEWLINE# #INDENT# flash ( gettext ( 'Failed to create record. %(error)s' , error = str ( ex ) ) , 'error' ) #NEWLINE# log . exception ( 'Failed to create record.' ) #NEWLINE# return False #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# self . after_model_change ( form , model , True ) #NEWLINE# #UNINDENT# return model