elif row[6] == "GT1YR_Total": if row[7] == "Total": if row[19] != " " or row[19] is not None: ayp_detail.math_school_total = row[19] print "Setting math_school_total = %s" % row[19] if row[23] == "Y": ayp_summary.math_status = True else: ayp_summary.math_status = False print "Setting summary.math_status to %s" % ayp_summary.math_status if row[29] != "" or row[29] != " " or row[29] is not None: ayp_detail.attendance_pct = row[29] print "Setting attendance_pct = %s" % row[29] if row[32] != "" or row[32] != " " or row[32] is not None: ayp_detail.graduation_pct = row[32] print "Setting graduation_pct = %s" % row[32] print "Updating AYP Detail for %s in %s for %s" % ( school, district, row[8] ) print "Updating AYP SUmmary for %s in %s for %s" % ( school, district, row[8] ) ayp_detail.save() ayp_summary.save() except: print 'There was an error on row %d' % count print bail() print "processing row %d" % count count += 1
skip_count = 0 update_count = 0 row_count = 0 for call in calls: if len(call.keys()) == 0: pass else: #print call try: if call[ "beat" ] == None: call[ "beat" ] = "" print "Setting beat to an empty string instead of None" beat = Beat.objects.get( name__iexact = str( call[ "beat" ] ) ) print "FOUND beat: %s" % call[ "beat" ] except: bail() print "No Beat found for %s" % call[ "beat" ] beat = Beat() beat.name = call[ "beat" ] beat.jurisdiction = juri beat.save() try: calltype = CallType.objects.get( name__iexact = str( call[ "calltype" ] ) ) print "FOUND calltype: %s" % call[ "calltype" ] except: bail() print "didn't find a calltype for %s" % call[ "calltype" ] calltype = CallType( name = call[ "calltype" ], jurisdiction = juri, active = True ) calltype.save()