old_contents: #!/usr/bin/env python
  
  import sys
  import csv
  import os
  import decimal
  
  os.environ['DJANGO_SETTINGS_MODULE'] = 'mzalendo.settings'
  sys.path.append('../../../')
  sys.path.append('../../')
  
  from mzalendo.core.models import Place
  from mzalendo.place_data.models import Entry
  
  filename = sys.argv[1]
  csv_file = open(filename, 'rU')
  
  csv_reader = csv.DictReader(csv_file, dialect='excel')
  
  for row in csv_reader:
      data_row = Entry()
  
      place_slug = row['slug'].strip()
      data_row.place = Place.objects.get(slug=place_slug)
  
      data_row.population_male = int(row['Male'])
      data_row.population_female = int(row['Female'])
      data_row.population_total = int(row['Total'])
      data_row.households_total = int(row['Households'])
      data_row.area = decimal.Decimal(row['Area in Sq. Km.'])
  
      data_row.save()
  
new_contents: #!/usr/bin/env python
  
  import sys
  import csv
  import os
  import decimal
  
  os.environ['DJANGO_SETTINGS_MODULE'] = 'mzalendo.settings'
  sys.path.append('../../../')
  sys.path.append('../../')
  
  from mzalendo.core.models import Place
  from mzalendo.place_data.models import Entry
  
  filename = sys.argv[1]
  csv_file = open(filename, 'rU')
  
  csv_reader = csv.DictReader(csv_file, dialect='excel')
  
  # Get rid of the padding around the fieldnames
  csv_reader.fieldnames = [x.strip() for x in csv_reader.fieldnames]
  
  for row in csv_reader:
      place_slug = row['slug'].strip()
  
      try:
          data_row = Entry.objects.get(place__slug=place_slug)
      except Entry.DoesNotExist:
          data_row = Entry()
          try:
              place = Place.objects.get(slug=place_slug)
          except:
              import pdb;pdb.set_trace()
          data_row.place = place
  
      data_row.population_male = int(row['Male Population'])
      data_row.population_female = int(row['Female Population'])
      data_row.population_total = int(row['Total Population'])
      data_row.population_rank = int(row['Population Rank 1=Highest'])
      data_row.gender_index = decimal.Decimal(row['Gender Ration Women:Men'])
      data_row.gender_index_rank = int(row['Women to Men Ratio Rank 1=Highest'])
      data_row.households_total = int(row['Number of Households'])
      data_row.average_household_size = decimal.Decimal(row['Average Houshold Size'])
      data_row.household_size_rank = int(row['Household Size Rank 1=Highest'])
      data_row.area = decimal.Decimal(row['Area in Sq. Km.'])
      data_row.area_rank = int(row['Area Size Rank 1=Highest'])
      data_row.population_density = decimal.Decimal(row['Density people per Sq. Km'])
      data_row.population_density_rank = int(row['Population Density Rank 1=Highest'])
      data_row.registered_voters_total = int(row['Total Registered Voters'])
      data_row.registered_voters_proportion = decimal.Decimal(row['Registered Voters as % of Population'])
      data_row.registered_voters_proportion_rank = int(row['Registered Voters % Rank 1=Highest'])
      data_row.youth_voters_proportion = decimal.Decimal(row['Youth Voters as a % of Total'])
      data_row.youth_voters_proportion_rank = int(row['Youth Voters % Rank 1=Highest'])
  
      data_row.save()
  
subject: Add more to constituency data import script.