data mapper under progress
This commit is contained in:
parent
35b93df6c1
commit
0402e18a64
|
@ -26,7 +26,7 @@ def Route_save(entry):
|
||||||
#print obj.__dict__
|
#print obj.__dict__
|
||||||
|
|
||||||
def HardCodedRoute_save(entry):
|
def HardCodedRoute_save(entry):
|
||||||
obj = HardCodedRoute(code=Route.objects.get(entry[0]), alias=entry[1], faretype=entry[2])
|
obj = HardCodedRoute(code=Route.objects.get(code=int(entry[0])), alias=entry[1], faretype=entry[2])
|
||||||
obj.save()
|
obj.save()
|
||||||
#print obj.__dict__
|
#print obj.__dict__
|
||||||
|
|
||||||
|
@ -88,13 +88,13 @@ def Stop_save(entry):
|
||||||
# There is no model as StopMarathi/AreaMarathi, but this is done to separate errors arising from different files, and also that the Marathi names should be done after the Stop and Area entities have been fully loaded cuz thats how we get them from BEST.
|
# There is no model as StopMarathi/AreaMarathi, but this is done to separate errors arising from different files, and also that the Marathi names should be done after the Stop and Area entities have been fully loaded cuz thats how we get them from BEST.
|
||||||
|
|
||||||
def StopMarathi_save(entry):
|
def StopMarathi_save(entry):
|
||||||
obj = Stop.objects.get(stopcd=int(entry[0]))
|
obj = Stop.objects.get(code=int(entry[0]))
|
||||||
obj.stopnm_mr = str(entry[1])
|
obj.stopnm_mr = str(entry[1])
|
||||||
obj.save()
|
obj.save()
|
||||||
#print obj.__dict__
|
#print obj.__dict__
|
||||||
|
|
||||||
def AreaMarathi_save(entry):
|
def AreaMarathi_save(entry):
|
||||||
obj = Area.objects.get(a_code=int(entry[0]))
|
obj = Area.objects.get(code=int(entry[0]))
|
||||||
obj.areanm_mr = str(entry[1])
|
obj.areanm_mr = str(entry[1])
|
||||||
obj.save()
|
obj.save()
|
||||||
#print obj.__dict__
|
#print obj.__dict__
|
||||||
|
@ -156,7 +156,7 @@ def CsvLoader(thismodel):
|
||||||
|
|
||||||
f.close()
|
f.close()
|
||||||
DataLinesInFile = CsvFile.line_num -1
|
DataLinesInFile = CsvFile.line_num -1
|
||||||
stats = str(DataLinesInFile - errcount ) + " " + thismodel + "s loaded. Number of Errors encountered: " + str(errcount)
|
stats = str(DataLinesInFile - errcount ) + " " + thismodel + "s loaded. Number of Errors encountered: " + str(errcount) + ". "
|
||||||
if errcount > 0 :
|
if errcount > 0 :
|
||||||
stats+="See " + thismodel + "Errors file for details."
|
stats+="See " + thismodel + "Errors file for details."
|
||||||
|
|
||||||
|
|
|
@ -78,13 +78,13 @@ class Stop(models.Model):
|
||||||
area = models.ForeignKey(Area)
|
area = models.ForeignKey(Area)
|
||||||
depot = models.ForeignKey("Depot", related_name='is_depot_for')
|
depot = models.ForeignKey("Depot", related_name='is_depot_for')
|
||||||
name_mr= models.TextField(null=True, blank=True, max_length=512)#null=True,
|
name_mr= models.TextField(null=True, blank=True, max_length=512)#null=True,
|
||||||
|
point = models.PointField(null=True)
|
||||||
def __unicode__(self):
|
def __unicode__(self):
|
||||||
return self.name
|
return self.name
|
||||||
|
|
||||||
|
|
||||||
class Route(models.Model):
|
class Route(models.Model):
|
||||||
code = models.TextField(max_length=255)
|
code = models.TextField(max_length=255, unique=True)
|
||||||
alias = models.TextField(max_length=255)
|
alias = models.TextField(max_length=255)
|
||||||
from_stop_txt = models.TextField(max_length=500)
|
from_stop_txt = models.TextField(max_length=500)
|
||||||
to_stop_txt = models.TextField(max_length=500)
|
to_stop_txt = models.TextField(max_length=500)
|
||||||
|
@ -99,7 +99,7 @@ class Route(models.Model):
|
||||||
|
|
||||||
class RouteDetail(models.Model):
|
class RouteDetail(models.Model):
|
||||||
# rno = models.TextField()
|
# rno = models.TextField()
|
||||||
route = models.ForeignKey(Route.code)
|
route = models.ForeignKey(Route, to_field="code")
|
||||||
serial = models.PositiveIntegerField()
|
serial = models.PositiveIntegerField()
|
||||||
stop = models.ForeignKey(Stop)
|
stop = models.ForeignKey(Stop)
|
||||||
stage = models.NullBooleanField()
|
stage = models.NullBooleanField()
|
||||||
|
@ -165,7 +165,7 @@ class RouteType(models.Model):
|
||||||
|
|
||||||
|
|
||||||
class HardCodedRoute(models.Model):
|
class HardCodedRoute(models.Model):
|
||||||
code = models.ForeignKey(Route.code)
|
code = models.ForeignKey(Route, to_field="code")
|
||||||
alias = models.TextField(max_length=50)
|
alias = models.TextField(max_length=50)
|
||||||
faretype = models.TextField(max_length=10)
|
faretype = models.TextField(max_length=10)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user