#NEWLINE# def load( self ) : #NEWLINE# #INDENT# headers = [ 'county' , 'office' , 'district' , 'party' , 'candidate' , 'votes' , 'winner' , 'write-in' , 'notes' ] #NEWLINE# self . _common_kwargs = self . _build_common_election_kwargs ( ) #NEWLINE# self . _common_kwargs [ 'reporting_level' ] = 'county' #NEWLINE# results = [ ] #NEWLINE# with self . _file_handle as csvfile : #NEWLINE# #INDENT# reader = unicodecsv . DictReader ( csvfile , fieldnames = headers , encoding = 'latin-1' ) #NEWLINE# for row in reader : #NEWLINE# #INDENT# if self . _skip_row ( row ) : #NEWLINE# #INDENT# continue #NEWLINE# #UNINDENT# rr_kwargs = self . _common_kwargs . copy ( ) #NEWLINE# rr_kwargs . update ( self . _build_contest_kwargs ( row ) ) #NEWLINE# rr_kwargs . update ( self . _build_candidate_kwargs ( row ) ) #NEWLINE# if ( row [ 'county' ] . strip ( ) == '' ) : #NEWLINE# #INDENT# rr_kwargs . update ( { #NEWLINE# #INDENT# 'contest_winner' : row [ 'winner' ] . strip ( ) , #NEWLINE# 'write_in' : row [ 'write-in' ] , #NEWLINE# 'notes' : reader [ 'notes' ] , #NEWLINE# #UNINDENT# } ) #NEWLINE# #UNINDENT# results . append ( RawResult ( ** rr_kwargs ) ) #NEWLINE# #UNINDENT# #UNINDENT# RawResult . objects . insert ( results )