#NEWLINE# def create( self , request , * args , **kwargs ) : #NEWLINE# #INDENT# if ( ( not self . has_model ( ) ) or ( not self . has_form ( ) ) ) : #NEWLINE# #INDENT# return rc . NOT_IMPLEMENTED #NEWLINE# #UNINDENT# if ( request . data is None ) : #NEWLINE# #INDENT# return rc . BAD_REQUEST #NEWLINE# #UNINDENT# if ( not self . check_create_permission ( request , 'x' ) ) : #NEWLINE# #INDENT# return rc . FORBIDDEN #NEWLINE# #UNINDENT# attrs = self . flatten_dict ( request ) #NEWLINE# inst = self . create_instance ( request , * args , ** kwargs ) #NEWLINE# form = self . form ( instance = inst , ** attrs ) #NEWLINE# if form . is_valid ( ) : #NEWLINE# #INDENT# obj = form . save ( ) #NEWLINE# obj . set_user_from_request ( request ) #NEWLINE# return obj #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# self . status = 400 #NEWLINE# return form . errors