From 689df93f8a75bfd4051a8dd51fc4ee7afbd13f55 Mon Sep 17 00:00:00 2001 From: Sanj Date: Fri, 16 Dec 2011 19:59:06 +0530 Subject: [PATCH] added subroute models --- chaloBEST/imports/import_atlas.py | 9 --------- chaloBEST/{ => mumbai}/admin.py | 0 chaloBEST/mumbai/models.py | 26 ++++++++++++++++++++++++++ 3 files changed, 26 insertions(+), 9 deletions(-) rename chaloBEST/{ => mumbai}/admin.py (100%) diff --git a/chaloBEST/imports/import_atlas.py b/chaloBEST/imports/import_atlas.py index 1511471..2751592 100644 --- a/chaloBEST/imports/import_atlas.py +++ b/chaloBEST/imports/import_atlas.py @@ -19,8 +19,6 @@ def csvToJSON(): jsonFile = open(join(PROJECT_ROOT, "../db_csv_files/Atlas.json"), "w") jsonFile.write(json.dumps(atlasDict, indent=2)) jsonFile.close() -<<<<<<< TREE - def getRouteCodes(): atlasRawCSV = csv.reader(open(join(PROJECT_ROOT, "../db_csv_files/AtlasRaw.csv"), "r"), delimiter="\t") @@ -40,14 +38,7 @@ def getRouteCodes(): mappingFile.write(json.dumps(mapping, indent=2)) mappingFile.close() -======= -<<<<<<< TREE def csvClean1(): atlasCSV = csv.reader(open(join(PROJECT_ROOT, "../db_csv_files/Atlas.csv"), "r"), delimiter="\t") - -======= - ->>>>>>> MERGE-SOURCE ->>>>>>> MERGE-SOURCE diff --git a/chaloBEST/admin.py b/chaloBEST/mumbai/admin.py similarity index 100% rename from chaloBEST/admin.py rename to chaloBEST/mumbai/admin.py diff --git a/chaloBEST/mumbai/models.py b/chaloBEST/mumbai/models.py index a78de93..d2ee009 100644 --- a/chaloBEST/mumbai/models.py +++ b/chaloBEST/mumbai/models.py @@ -52,6 +52,32 @@ class RouteDetails(models.Model): return self.rno +class SubRoute(models.Model): + from_stop = models.ForeignKey(Stop, related_name="subroutes_from") + to_stop = models.ForeignKey(Stop, related_name="subroutes_to") + route = models.ForeignKey("Route") + is_longest = models.BooleanField() + span = models.FloatField() + + +class SubrouteSchedule(models.Model): + subroute = models.ForeignKey(SubRoute) + schedule_type = models.ForeignKey("ScheduleType") + first_from = models.FloatField(null=True, blank=True) + last_from = models.FloatField(null=True, blank=True) + first_to = models.FloatField(null=True, blank=True) + last_to = models.FloatField(null=True, blank=True) + headway07 = models.IntegerField(null=True, blank=True) + headway711 = models.IntegerField(null=True, blank=True) + headway1117 = models.IntegerField(null=True, blank=True) + headway1720 = models.IntegerField(null=True, blank=True) + headway20 = models.IntegerField(null=True, blank=True) + +class ScheduleType(models.Model): + name = models.CharField(max_length=10) + + def __unicode__(self): + return self.name class Route(models.Model): route = models.TextField(max_length=255)