gtfs . . .v9.6

This commit is contained in:
Johnson Chetty 2012-09-18 20:06:49 +02:00
parent 0a21330efd
commit 1ba4f9e9e0
4 changed files with 27 additions and 5 deletions

View File

@ -297,14 +297,12 @@ def CsvLoader(thismodel):
def fire_up():
for model in saveorder:
CsvLoader(model)
loadFKinRouteDetail()
# also
importUniqueRoutes()
print "loading UniqueRoute..."
#postclean.copydefaultStopLocations()
postclean.copynames2display_name()
postclean.make_stage_info()
postclean.make_type_info()
#----------------------------------------------------------

View File

@ -16,5 +16,20 @@ def copynames2display_name():
obj.display_name =obj.name
obj.save()
def make_stage_info():
for rd in RouteDetail.objects.all():
if rd.km:
rd.stage=True
rd.save()
def make_type_info():
for r in Route.objects.all():
r.route_type = RouteType.objects.get(code=str(r.code)[3])
r.save()
def make_code_info():
for r in Route.objects.all():
if r.code.isdigit():
r.code3 = str(r.code)[0:3]
r.save()

View File

@ -257,7 +257,8 @@ class Route(models.Model):
to_stop = models.ForeignKey(Stop, related_name='routes_to', default=None, null=True, blank=True)
distance = models.DecimalField(max_digits=3, decimal_places=1)
stages = models.IntegerField()
route_type = models.ForeignKey('RouteType', default=0, null=True, blank=True)
code3 = models.CharField(max_length=5)
class Meta:
ordering = ['code']

View File

@ -0,0 +1,8 @@
ALTER TABLE "mumbai_route" ADD COLUMN "code3" string;
ALTER TABLE "mumbai_route" ADD COLUMN "route_type_id" integer;
ALTER TABLE "mumbai_route" ADD CONSTRAINT "route_type_id_refs_id_6b818b01" FOREIGN KEY ("route_type_id") REFERENCES "mumbai_routetype" ("id") DEFERRABLE INITIALLY DEFERRED;