#NEWLINE# def form_invalid( self , form ) : #NEWLINE# #INDENT# result = super ( SingleObjectCreateView , self ) . form_invalid ( form ) #NEWLINE# try : #NEWLINE# #INDENT# messages . error ( self . request , ( _ ( 'Error creating new %s.' ) % form . extra_context [ 'object_name' ] ) ) #NEWLINE# #UNINDENT# except KeyError : #NEWLINE# #INDENT# messages . error ( self . request , _ ( 'Error creating object.' ) ) #NEWLINE# #UNINDENT# return result