#NEWLINE# def load_dat( self ) : #NEWLINE# #INDENT# '\n        Takes a model and a csv file and loads it into dat\n        ' #NEWLINE# import datpy #NEWLINE# dat_source = settings . CALACCESS_DAT_SOURCE #NEWLINE# self . dat = datpy . Dat ( dat_source [ 'source' ] ) #NEWLINE# dataset = self . dat . dataset ( self . model . _meta . db_table ) #NEWLINE# try : #NEWLINE# #INDENT# dataset . import_file ( self . csv , format = 'csv' ) #NEWLINE# if ( self . verbosity > 2 ) : #NEWLINE# #INDENT# dat_status = self . dat . status ( ) #NEWLINE# model_count = dat_status [ 'rows' ] #NEWLINE# csv_count = self . get_row_count ( self . csv ) #NEWLINE# self . finish_load_message ( model_count , csv_count ) #NEWLINE# #UNINDENT# #UNINDENT# except datpy . DatException : #NEWLINE# #INDENT# raise CommandError ( ( 'Failed to load dat for %s, %s' % ( self . model . _meta . db_table , self . csv ) ) )