import random
import csv

from django.core.management.base import BaseCommand, CommandError

from portal.models import Location


class Command(BaseCommand):
    """
    """

    def handle(self, *args, **options):
        """
        """

        with open('availability.csv', 'rb') as availability_file:
            reader = csv.DictReader(availability_file)
            
            for row in reader:

                try:
                    key = row['Key']
                    l = Location.objects.get(ecm_key=key)
                    print l.site_name


@@ -539,23 +539,202 @@
     
-print l.site_name
+l.availability = row%5B'Availability'%5D%0A                    l.save()%0A                    print l.availability%0A                    print ''%0A%0A                except:%0A%0A                    print 'Uh oh!'
 %0A%0A

Add logic for availability population