Changes made to home page and started work on data_mapper, models file tweaked a bit to allow nulls in marathi fields
This commit is contained in:
parent
013af6003a
commit
78741aca7b
|
@ -6,68 +6,75 @@ import json
|
|||
import datetime
|
||||
import sys
|
||||
|
||||
CsvFile = csv.reader(open("/home/johnson/Desktop/chaloBEST/db_csv_files/AreaMaster.csv", "r"))
|
||||
CsvFile.next()
|
||||
for entry in CsvFile:
|
||||
obj = Area(int(entry[0]), entry[1])
|
||||
obj.save()
|
||||
print obj.a_code, obj.areanm
|
||||
def AreaLoader():
|
||||
CsvFile = csv.reader(open("/home/johnson/Desktop/chaloBEST/db_csv_files/AreaMaster.csv", "r"))
|
||||
CsvFile.next()
|
||||
for entry in CsvFile:
|
||||
obj = Area(int(entry[0]), entry[1])
|
||||
obj.save()
|
||||
print obj.a_code, obj.areanm
|
||||
|
||||
print "----- "
|
||||
print "----- "
|
||||
return
|
||||
|
||||
CsvFile = csv.reader(open("/home/johnson/Desktop/chaloBEST/chaloBEST/db_csv_files/FareMaster.csv", "r"))
|
||||
test = CsvFile.next()
|
||||
print test
|
||||
for entry in CsvFile:
|
||||
obj = Fare(slab=float(entry[0]), ordinary=int(entry[1]), limited=int(entry[2]), express=int(entry[3]), ac=int(entry[4]), ac_express=int(entry[5]))
|
||||
obj.save()
|
||||
print obj.__dict__
|
||||
def FareLoader():
|
||||
CsvFile = csv.reader(open("/home/johnson/Desktop/chaloBEST/chaloBEST/db_csv_files/FareMaster.csv", "r"))
|
||||
test = CsvFile.next()
|
||||
print test
|
||||
for entry in CsvFile:
|
||||
obj = Fare(slab=float(entry[0]), ordinary=int(entry[1]), limited=int(entry[2]), express=int(entry[3]), ac=int(entry[4]), ac_express=int(entry[5]))
|
||||
obj.save()
|
||||
print obj.__dict__
|
||||
return
|
||||
|
||||
def RoadLoader():
|
||||
CsvFile = csv.reader(open("/home/johnson/Desktop/chaloBEST/db_csv_files/RoadMaster.csv", "r"))
|
||||
test = CsvFile.next()
|
||||
print test
|
||||
for entry in CsvFile:
|
||||
obj = Road(roadcd=int(entry[0]), roadnm=str(entry[1]))
|
||||
obj.save()
|
||||
print obj.__dict__
|
||||
return
|
||||
|
||||
CsvFile = csv.reader(open("/home/johnson/Desktop/chaloBEST/db_csv_files/RoadMaster.csv", "r"))
|
||||
test = CsvFile.next()
|
||||
print test
|
||||
for entry in CsvFile:
|
||||
obj = Road(roadcd=int(entry[0]), roadnm=str(entry[1]))
|
||||
obj.save()
|
||||
print obj.__dict__
|
||||
def RouteLoader():
|
||||
CsvFile = csv.reader(open("/home/johnson/Desktop/chaloBEST/db_csv_files/RouteMaster.csv", "r"), delimiter='\t')
|
||||
test = CsvFile.next()
|
||||
print test
|
||||
for entry in CsvFile:
|
||||
obj = Route(route=entry[0], routealias=entry[1], from_stop=entry[2], to_stop=entry[3], distance=float(entry[4]), stages=int(entry[5]))
|
||||
print obj.__dict__
|
||||
return
|
||||
|
||||
def RouteDetailsLoader():
|
||||
CsvFile = csv.reader(open("/home/johnson/Desktop/chaloBEST/db_csv_files/RouteDetails.csv", "r"), delimiter='\t')
|
||||
test = CsvFile.next()
|
||||
print test
|
||||
for entry in CsvFile:
|
||||
try:
|
||||
print obj.__dict__
|
||||
obj = RouteDetails(rno=entry[0], stopsr=int(entry[1]), stopdcd=Stop.objects.get(stopcd=int(entry[2])), stage=entry[3].startswith('1'), km=float(entry[4]))
|
||||
|
||||
except:
|
||||
f.write(obj.__dict__)
|
||||
return
|
||||
#RNO,STOPSR,STOPCD,STAGE,KM
|
||||
|
||||
CsvFile = csv.reader(open("/home/johnson/Desktop/chaloBEST/db_csv_files/RouteMaster.csv", "r"), delimiter='\t')
|
||||
test = CsvFile.next()
|
||||
print test
|
||||
for entry in CsvFile:
|
||||
obj = Route(route=entry[0], routealias=entry[1], from_stop=entry[2], to_stop=entry[3], distance=float(entry[4]), stages=int(entry[5]))
|
||||
print obj.__dict__
|
||||
def AreaLoader():
|
||||
CsvFile = csv.reader(open("/home/johnson/Desktop/chaloBEST/chaloBEST/db_csv_files/RouteDetails.csv", "r"), delimiter='\t')
|
||||
f= open('RouteDetailsErrors', 'w')
|
||||
test = CsvFile.next()
|
||||
print test
|
||||
for entry in CsvFile:
|
||||
try:
|
||||
obj = RouteDetails(rno=entry[0], stopsr=int(entry[1]), stopcd=Stop.objects.get(stopcd=int(entry[2])), stage=(lambda:entry[3].startswith('1'), lambda:None)[ entry[3] == '' ](), km=(lambda:None,lambda:float(entry[4]))[ entry[4] != '' ]() )
|
||||
obj.save()
|
||||
obj.__dict__
|
||||
except :
|
||||
f.write(str(sys.exc_info()[0]) + str(entry) + '\n')
|
||||
print "Error:", sys.exc_info()[0]
|
||||
|
||||
|
||||
CsvFile = csv.reader(open("/home/johnson/Desktop/chaloBEST/db_csv_files/RouteDetails.csv", "r"), delimiter='\t')
|
||||
test = CsvFile.next()
|
||||
print test
|
||||
for entry in CsvFile:
|
||||
try:
|
||||
print obj.__dict__
|
||||
obj = RouteDetails(rno=entry[0], stopsr=int(entry[1]), stopdcd=Stop.objects.get(stopcd=int(entry[2])), stage=entry[3].startswith('1'), km=float(entry[4]))
|
||||
|
||||
except:
|
||||
f.write(obj.__dict__)
|
||||
|
||||
RNO,STOPSR,STOPCD,STAGE,KM
|
||||
|
||||
CsvFile = csv.reader(open("/home/johnson/Desktop/chaloBEST/chaloBEST/db_csv_files/RouteDetails.csv", "r"), delimiter='\t')
|
||||
f= open('RouteDetailsErrors', 'w')
|
||||
test = CsvFile.next()
|
||||
print test
|
||||
for entry in CsvFile:
|
||||
try:
|
||||
obj = RouteDetails(rno=entry[0], stopsr=int(entry[1]), stopcd=Stop.objects.get(stopcd=int(entry[2])), stage=(lambda:entry[3].startswith('1'), lambda:None)[ entry[3] == '' ](), km=(lambda:None,lambda:float(entry[4]))[ entry[4] != '' ]() )
|
||||
obj.save()
|
||||
obj.__dict__
|
||||
except :
|
||||
f.write(str(sys.exc_info()[0]) + str(entry) + '\n')
|
||||
print "Error:", sys.exc_info()[0]
|
||||
|
||||
f.close()
|
||||
f.close()
|
||||
|
||||
date_format = entry[0].rsplit('.')
|
||||
theday = int(date_format[0])
|
||||
|
@ -78,41 +85,62 @@ import datetime
|
|||
|
||||
def holiday_loader():
|
||||
|
||||
CsvFile = csv.reader(open(join(PROJECT_ROOT, "../db_csv_files/Holidays.csv"), "r"), delimiter="\t")
|
||||
f= open('HolidaysErrors', 'w')
|
||||
test = CsvFile.next()
|
||||
print test
|
||||
for entry in CsvFile:
|
||||
try:
|
||||
date_format = entry[0].rsplit('.')
|
||||
theday = int(date_format[0])
|
||||
themonth = int(date_format[1])
|
||||
theyear = int('20'+ date_format[2])
|
||||
obj = Holiday(h_date=datetime.date(day=theday, month=themonth, year=theyear), h_name=str(entry[1]))
|
||||
obj.save()
|
||||
obj.__dict__
|
||||
except :
|
||||
f.write(str(sys.exc_info()[0]) + str(entry) + '\n')
|
||||
print "Error:", sys.exc_info()[0]
|
||||
CsvFile = csv.reader(open(join(PROJECT_ROOT, "../db_csv_files/Holidays.csv"), "r"), delimiter="\t")
|
||||
f= open('HolidaysErrors', 'w')
|
||||
test = CsvFile.next()
|
||||
print test
|
||||
for entry in CsvFile:
|
||||
try:
|
||||
date_format = entry[0].rsplit('.')
|
||||
theday = int(date_format[0])
|
||||
themonth = int(date_format[1])
|
||||
theyear = int('20'+ date_format[2])
|
||||
obj = Holiday(h_date=datetime.date(day=theday, month=themonth, year=theyear), h_name=str(entry[1]))
|
||||
obj.save()
|
||||
obj.__dict__
|
||||
except :
|
||||
f.write(str(sys.exc_info()[0]) + str(entry) + '\n')
|
||||
print "Error:", sys.exc_info()[0]
|
||||
|
||||
f.close()
|
||||
return
|
||||
|
||||
def RouteLoader():
|
||||
CsvFile = csv.reader(open(join(PROJECT_ROOT, "../db_csv_files/Route.csv"), "r"), delimiter="\t")
|
||||
f= open(join(PROJECT_ROOT, "../db_csv_files/RouteErrors.csv"), 'w')
|
||||
header = CsvFile.next()
|
||||
print header
|
||||
for entry in CsvFile:
|
||||
try:
|
||||
obj = Route(route=entry[0], routealias=entry[1], from_stop=entry[2], to_stop=entry[3], distance=float(entry[4]), stages=int(entry[5]))
|
||||
obj.save()
|
||||
obj.__dict__
|
||||
except :
|
||||
f.write(str(sys.exc_info()[0]) + str(entry) + '\n')
|
||||
print "Error:", sys.exc_info()[0] + str(entry)
|
||||
|
||||
f.close()
|
||||
return
|
||||
|
||||
obj = Route(route=entry[0], routealias=entry[1], from_stop=entry[2], to_stop=entry[3], distance=float(entry[4]), stages=int(entry[5]))
|
||||
|
||||
f.close()
|
||||
|
||||
def Depot_loader():
|
||||
CsvFile = csv.reader(open(join(PROJECT_ROOT, "../db_csv_files/Depot.csv"), "r"), delimiter="\t")
|
||||
f= open(join(PROJECT_ROOT, "../db_csv_files/DepotErrors.csv"), 'w')
|
||||
header = CsvFile.next()
|
||||
print header
|
||||
for entry in CsvFile:
|
||||
try:
|
||||
obj = Depot(depot_code=str(entry[0]),depot_name=str(entry[1]), stop = Stop.objects.get(stopcd=int(entry[2])))
|
||||
obj.save()
|
||||
obj.__dict__
|
||||
except :
|
||||
f.write(str(sys.exc_info()[0]) + str(entry) + '\n')
|
||||
print "Error:", sys.exc_info()[0] + str(entry)
|
||||
|
||||
f.close()
|
||||
CsvFile = csv.reader(open(join(PROJECT_ROOT, "../db_csv_files/Depot.csv"), "r"), delimiter="\t")
|
||||
f= open(join(PROJECT_ROOT, "../db_csv_files/DepotErrors.csv"), 'w')
|
||||
header = CsvFile.next()
|
||||
print header
|
||||
for entry in CsvFile:
|
||||
try:
|
||||
obj = Depot(depot_code=str(entry[0]),depot_name=str(entry[1]), stop = Stop.objects.get(stopcd=int(entry[2])))
|
||||
obj.save()
|
||||
obj.__dict__
|
||||
except :
|
||||
f.write(str(sys.exc_info()[0]) + str(entry) + '\n')
|
||||
print "Error:", sys.exc_info()[0] + str(entry)
|
||||
|
||||
f.close()
|
||||
return
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -42,14 +42,14 @@ SCHED = {
|
|||
class Area(models.Model):
|
||||
a_code = models.IntegerField(primary_key=True)
|
||||
areanm = models.TextField(blank=True, max_length=255)
|
||||
areanm_mr= models.TextField(blank=True, max_length=512)
|
||||
areanm_mr= models.TextField(null=True, blank=True, max_length=512) #null=True,
|
||||
def __unicode__(self):
|
||||
return self.areanm
|
||||
|
||||
class Road(models.Model):
|
||||
roadcd = models.IntegerField(primary_key=True)
|
||||
roadnm = models.TextField(blank=True, max_length=255)
|
||||
#roadnm_mr= models.TextField(blank=True, max_length=512)
|
||||
roadnm_mr= models.TextField(null=True, blank=True, max_length=512)
|
||||
def __unicode__(self):
|
||||
return self.roadnm
|
||||
|
||||
|
@ -74,7 +74,7 @@ class Stop(models.Model):
|
|||
roadcd = models.ForeignKey(Road)
|
||||
a_code = models.ForeignKey(Area)
|
||||
depot = models.TextField(max_length=255) # should actually be a foreign key to a depotMaster,
|
||||
stopnm_mr= models.TextField(blank=True, max_length=512)
|
||||
stopnm_mr= models.TextField(null=True, blank=True, max_length=512)#null=True,
|
||||
|
||||
def __unicode__(self):
|
||||
return self.stopnm
|
||||
|
|
|
@ -6,25 +6,33 @@
|
|||
<title>ChaloBEST</title>
|
||||
|
||||
</head>
|
||||
<body bgcolor="#000000">
|
||||
<body link="white" vlink="white" alink="white">
|
||||
|
||||
<font color="white">
|
||||
<center>
|
||||
<font color="white">
|
||||
<center>
|
||||
<div>
|
||||
<img src="/static/images/logo.png">
|
||||
</div>
|
||||
<div>
|
||||
<h3>Free and simple tools to find bus routes in Mumbai, coming soon to your phone.</h3>
|
||||
<h3>Try out our <a href="http://m.chalobest.in">mobile website</a>, <a href="http://sms.chalobest.in">SMS service</a>, and <a href="http://droid.chalobest.in">Android application</a>.</h3>
|
||||
<br><br>
|
||||
<p>Want to get involved or learn more? Check out our <a href="http://wiki.chalobest.in">project wiki</a> or join our <a href="http://gnowledge.org/cgi-bin/mailman/listinfo/smsbest">mailing list</a>.
|
||||
<br>
|
||||
<p><a href="http://chalobest.in">ChaloBEST</a> is a collaboration of <a href="http://mesn.org">Mumbai Environmental Social Network (MESN)</a>, <a href="http://sparcsys.com">SPARC Systems</a>, <a href="http://camputer.org">CAMP</a>, and <br> <a href="http://www.hbcse.tifr.res.in">Homi Bhabha Centre for Science Education, TIFR</a>, with support from <a href="http://bestundertaking.com">BEST (Brihanmumbai Electric Supply & Transport Undertaking)</a>.</p>
|
||||
|
||||
</center>
|
||||
</font>
|
||||
</body>
|
||||
<div>
|
||||
<h3>Free and simple tools to find your way through Mumbai, coming soon to SMS, web and smartphone.</h3>
|
||||
|
||||
<p>Want to get involved or learn more? Check out our <a href="http://wiki.chalobest.in/">project wiki</a> or join our <a href="http://gnowledge.org/cgi-bin/mailman/listinfo/smsbest">mailing list</a>.
|
||||
<br>
|
||||
</p>
|
||||
<p>
|
||||
<a href="http://chalobest.in/">ChaloBEST</a> is a collaboration of <a href="http://camputer.org/">CAMP</a>, <a href="http://mgtech.in/">MacGregor TechKnowlogy</a>, <a href="http://sparcsys.com/">SPARC Systems</a>, <a href="http://userinnov.com/">UserINNOV</a>, and the<br> <a href="http://www.hbcse.tifr.res.in/">Homi Bhabha Centre for Science Education, Tata Institute of Fundamental Research (TIFR)</a>.
|
||||
</p>
|
||||
<p>
|
||||
We are funded by the <a href="http://iihs.ac.in/">Indian Institute of Human Settlements</a> as the first-prize winners in the <br> <a href="http://transformurbanindia.com/">Sankranti Transform Urban India</a> competition at the <a href="http://iuc2011.in">India Urban Conference 2011</a>.
|
||||
</p>
|
||||
|
||||
<p>We are also supported by the Traffic Planning Department of the <a href="http://bestundertaking.com/">BEST (Brihanmumbai Electric Supply & Transport Undertaking)</a>.
|
||||
</p>
|
||||
|
||||
</div>
|
||||
</center>
|
||||
</font>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user