# Path: elections/settings.py
# DEFAULT_SETTINGS = {
#     'TEST_DATA_ONLY': False,
#     'FTP_USER': 'anonymous',
#     'FTP_PASSWORD': '',
#     'FTP_HOST': '',
#     'DOWNLOAD_PATHS': [],
#     'DEST_PATH': '/tmp/election/',
#     'IMAGE_MODEL': None,
#     'IMAGE_STORAGE': settings.DEFAULT_FILE_STORAGE,
#     'MAP_RESULTS_DEST': '',
# }
# USER_SETTINGS = DEFAULT_SETTINGS.copy()
# 
# Path: elections/fields.py
# class TestFlagField(CharField):
#     """
#     t is test data and l is live data field
#     
#     Can't override choices or max_length
#     """
#     def __init__(self, **kwargs):
#         default_args = {
#             'choices': (('t', _('Test Data')), ('l', _('Live Data'))),
#             'max_length': 1,
#             'default': {True: 't', False: 'l'}[TEST_DATA_ONLY]
#         }
#         if 'choices' in kwargs:
#             kwargs.pop('choices')
#         if 'max_length' in kwargs:
#             kwargs.pop('max_length')
#         default_args.update(kwargs)
#         super(TestFlagField, self).__init__(**default_args)


from django.db import models
from django.db.models import get_model
from django.core.files.storage import get_storage_class
from .settings import TEST_DATA_ONLY, IMAGE_MODEL, IMAGE_STORAGE
from .fields import TestFlagField
            from django.template.defaultfilters import slugify
            from django.template.defaultfilters import slugify
        import hashlib
        import hashlib
        import hashlib
        import hashlib
        import hashlib
        import hashlib
        import hashlib
        import hashlib


class CountyResult(models.Model):
    """
    Results of a county election
    """
    test_flag = TestFlagField()
    race_county = models.ForeignKey(RaceCounty)
    ap_candidate = models.ForeignKey(
        Candidate, 
        to_field='ap_candidate_id',
        related_name="county_results")
    party = models.CharField(blank=True, null=True, max_length=16)
    incumbent = models.BooleanField(default=False)
    vote_count = models.IntegerField(default=0)
    winner = models.CharField(blank=True, null=True, max_length=1)
    natl_order = models.IntegerField(blank=True, null=True)
    
    objects = TestDataManager()
    
    class Meta:
        pass
    
    def __unicode__(self):
        return u"CountyResult"

class DistrictResult(models.Model):
    """
    Results of a district election
    """

# Path: elections/settings.py
# DEFAULT_SETTINGS = {
#     'TEST_DATA_ONLY': False,
#     'FTP_USER': 'anonymous',
#     'FTP_PASSWORD': '',
#     'FTP_HOST': '',
#     'DOWNLOAD_PATHS': [],
#     'DEST_PATH': '/tmp/election/',
#     'IMAGE_MODEL': None,
#     'IMAGE_STORAGE': settings.DEFAULT_FILE_STORAGE,
#     'MAP_RESULTS_DEST': '',
# }
# USER_SETTINGS = DEFAULT_SETTINGS.copy()
# 
# Path: elections/fields.py
# class TestFlagField(CharField):
#     """
#     t is test data and l is live data field
#     
#     Can't override choices or max_length
#     """
#     def __init__(self, **kwargs):
#         default_args = {
#             'choices': (('t', _('Test Data')), ('l', _('Live Data'))),
#             'max_length': 1,
#             'default': {True: 't', False: 'l'}[TEST_DATA_ONLY]
#         }
#         if 'choices' in kwargs:
#             kwargs.pop('choices')
#         if 'max_length' in kwargs:
#             kwargs.pop('max_length')
#         default_args.update(kwargs)
#         super(TestFlagField, self).__init__(**default_args)


# Path: elections/models.py
from django.db import models
from django.db.models import get_model
from django.core.files.storage import get_storage_class
from .settings import TEST_DATA_ONLY, IMAGE_MODEL, IMAGE_STORAGE
from .fields import TestFlagField
            from django.template.defaultfilters import slugify
            from django.template.defaultfilters import slugify
        import hashlib
        import hashlib
        import hashlib
        import hashlib
        import hashlib
        import hashlib
        import hashlib
        import hashlib



class CountyResult(models.Model):
    """
    Results of a county election
    """
    test_flag = TestFlagField()
    race_county = models.ForeignKey(RaceCounty)
    ap_candidate = models.ForeignKey(
        Candidate, 
        to_field='ap_candidate_id',
        related_name="county_results")
    party = models.CharField(blank=True, null=True, max_length=16)
    incumbent = models.BooleanField(default=False)
    vote_count = models.IntegerField(default=0)
    winner = models.CharField(blank=True, null=True, max_length=1)
    natl_order = models.IntegerField(blank=True, null=True)
    
    objects = TestDataManager()
    
    class Meta:
        pass
    
    def __unicode__(self):
        return u"CountyResult"

class DistrictResult(models.Model):
    """
    Results of a district election
    """

    test_flag = TestFlagField()