<s> from django . db import models <EOL> from django . utils . datastructures import SortedDict <EOL> from calaccess_campaign_browser import managers <EOL> from calaccess_campaign_browser . utils . models import BaseModel <EOL> class Expenditure ( BaseModel ) : <EOL> """<STR_LIT>""" <EOL> cycle = models . ForeignKey ( '<STR_LIT>' ) <EOL> committee = models . ForeignKey ( <EOL> '<STR_LIT>' , <EOL> related_name = '<STR_LIT>' <EOL> ) <EOL> filing = models . ForeignKey ( '<STR_LIT>' ) <EOL> filing_id_raw = models . IntegerField ( db_index = True , null = True ) <EOL> transaction_id = models . CharField ( <EOL> '<STR_LIT>' , <EOL> max_length = <NUM_LIT:20> , <EOL> db_index = True , <EOL> blank = True , <EOL> null = True <EOL> ) <EOL> amend_id = models . IntegerField ( '<STR_LIT>' , db_index = True ) <EOL> backreference_transaction_id = models . CharField ( <EOL> '<STR_LIT>' , <EOL> max_length = <NUM_LIT:50> , <EOL> db_index = True <EOL> ) <EOL> is_crossreference = models . CharField ( max_length = <NUM_LIT:1> , blank = True ) <EOL> crossreference_schedule = models . CharField ( max_length = <NUM_LIT:2> , blank = True ) <EOL> is_duplicate = models . BooleanField ( default = False ) <EOL> date_received = models . DateField ( null = True ) <EOL> expenditure_description = models . CharField ( max_length = <NUM_LIT:255> , blank = True ) <EOL> amount = models . DecimalField ( max_digits = <NUM_LIT:16> , decimal_places = <NUM_LIT:2> ) <EOL> candidate_full_name = models . CharField ( max_length = <NUM_LIT:255> ) <EOL> candidate_is_person = models . BooleanField ( default = False ) <EOL> candidate_committee = models . ForeignKey ( <EOL> '<STR_LIT>' , <EOL> null = True , <EOL> related_name = "<STR_LIT>" <EOL> ) <EOL> candidate_prefix = models . CharField ( max_length = <NUM_LIT:10> , blank = True ) <EOL> candidate_first_name = models . CharField ( max_length = <NUM_LIT:255> , blank = True ) <EOL> candidate_last_name = models . CharField ( max_length = <NUM_LIT:200> , blank = True ) <EOL> candidate_suffix = models . CharField ( max_length = <NUM_LIT:10> , blank = True ) <EOL> EXPENDITURE_CODE_CHOICES = ( <EOL> ( '<STR_LIT>' , '<STR_LIT>' ) , <EOL> ( '<STR_LIT>' , '<STR_LIT>' ) , <EOL> ( '<STR_LIT>' , '<STR_LIT>' ) , <EOL> ( '<STR_LIT>' , '<STR_LIT>' ) , <EOL> ( '<STR_LIT>' , '<STR_LIT>' ) , <EOL> ( '<STR_LIT>' , '<STR_LIT>' ) , <EOL> ( '<STR_LIT>' , <EOL> '<STR_LIT>' ) , <EOL> ( '<STR_LIT>' , '<STR_LIT>' ) , <EOL> ( '<STR_LIT>' , '<STR_LIT>' ) , <EOL> ( '<STR_LIT>' , '<STR_LIT>' ) , <EOL> ( '<STR_LIT>' , '<STR_LIT>' ) , <EOL> ( '<STR_LIT>' , '<STR_LIT>' ) , <EOL> ( '<STR_LIT>' , '<STR_LIT>' ) , <EOL> ( '<STR_LIT>' , '<STR_LIT>' ) , <EOL> ( '<STR_LIT>' , '<STR_LIT>' ) , <EOL> ( '<STR_LIT>' , '<STR_LIT>' ) , <EOL> ( '<STR_LIT>' , '<STR_LIT>' ) , <EOL> ( '<STR_LIT>' , '<STR_LIT>' ) , <EOL> ( '<STR_LIT>' , '<STR_LIT>' ) , <EOL> ( '<STR_LIT>' , '<STR_LIT>' ) , <EOL> ( '<STR_LIT>' , "<STR_LIT>" ) , <EOL> ( '<STR_LIT>' , '<STR_LIT>' ) , <EOL> ( '<STR_LIT>' , '<STR_LIT>' ) , <EOL> ( '<STR_LIT>' , '<STR_LIT>' ) , <EOL> ( '<STR_LIT>' , '<STR_LIT>' ) , <EOL> ( '<STR_LIT>' , '<STR_LIT>' ) , <EOL> ( '<STR_LIT>' , '<STR_LIT>' ) , <EOL> ) <EOL> candidate_expense_code = models . CharField ( <EOL> max_length = <NUM_LIT:3> , <EOL> blank = True , <EOL> choices = EXPENDITURE_CODE_CHOICES <EOL> ) <EOL> ENTITY_CD_CHOICES = ( <EOL> ( '<STR_LIT>' , '<STR_LIT>' ) , <EOL> ( '<STR_LIT>' , '<STR_LIT>' ) , <EOL> ( '<STR_LIT>' , '<STR_LIT>' ) , <EOL> ( '<STR_LIT>' , '<STR_LIT>' ) , <EOL> ( '<STR_LIT>' , '<STR_LIT>' ) , <EOL> ( '<STR_LIT>' , '<STR_LIT>' ) , <EOL> ( '<STR_LIT>' , '<STR_LIT>' ) , <EOL> ( '<STR_LIT>' , '<STR_LIT>' ) , <EOL> ( '<STR_LIT>' , '<STR_LIT>' ) , <EOL> ( '<STR_LIT>' , '<STR_LIT>' ) , <EOL> ( '<STR_LIT>' , '<STR_LIT>' ) , <EOL> ( '<STR_LIT>' , '<STR_LIT>' ) , <EOL> ( '<STR_LIT:0>' , '<STR_LIT>' ) , <EOL> ) <EOL> candidate_entity_type = models . CharField ( <EOL> max_length = <NUM_LIT:3> , <EOL> blank = True , <EOL> help_text = "<STR_LIT>" , <EOL> choices = ENTITY_CD_CHOICES <EOL> ) <EOL> payee_prefix = models . CharField ( max_length = <NUM_LIT:10> , blank = True ) <EOL> payee_first_name = models . CharField ( max_length = <NUM_LIT:255> , blank = True ) <EOL> payee_last_name = models . CharField ( max_length = <NUM_LIT:200> , blank = True ) <EOL> payee_suffix = models . CharField ( max_length = <NUM_LIT:10> , blank = True ) <EOL> payee_city = models . CharField ( max_length = <NUM_LIT:30> , blank = True ) <EOL> payee_state = models . CharField ( max_length = <NUM_LIT:2> , blank = True ) <EOL> payee_zipcode = models . CharField ( max_length = <NUM_LIT:10> , blank = True ) <EOL> payee_committee_id = models . CharField ( max_length = <NUM_LIT:9> , blank = True ) <EOL> objects = models . Manager ( ) <EOL> real = managers . RealExpenditureManager ( ) <EOL> class Meta : <EOL> app_label = '<STR_LIT>' <EOL> @ models . permalink <EOL> def get_absolute_url ( self ) : <EOL> return ( '<STR_LIT>' , [ str ( self . pk ) ] ) <EOL> @ property <EOL> def raw ( self ) : <EOL> from calaccess_raw . models import ExpnCd <EOL> return ExpnCd . objects . get ( <EOL> amend_id = self . amend_id , <EOL> filing_id = self . filing . filing_id_raw , <EOL> tran_id = self . transaction_id , <EOL> bakref_tid = self . backreference_transaction_id <EOL> ) <EOL> @ property <EOL> def candidate_dict ( self ) : <EOL> d = SortedDict ( { } ) <EOL> for k , v in self . to_dict ( ) . items ( ) : <EOL> if k . startswith ( "<STR_LIT>" ) : <EOL> d [ k . replace ( "<STR_LIT>" , "<STR_LIT>" ) ] = v <EOL> return d <EOL> @ property <EOL> def payee_dict ( self ) : <EOL> d = SortedDict ( { } ) <EOL> for k , v in self . to_dict ( ) . items ( ) : <EOL> if k . startswith ( "<STR_LIT>" ) : <EOL> d [ k . replace ( "<STR_LIT>" , "<STR_LIT>" ) ] = v <EOL> return d </s>
