schema for atlas import added to models.py

This commit is contained in:
Sanj 2012-01-02 16:50:51 +05:30
parent 00d51e0d78
commit 86928205c1
2 changed files with 36 additions and 6 deletions

View File

@ -19,12 +19,7 @@ def csvToJSON():
jsonFile = open(join(PROJECT_ROOT, "../db_csv_files/Atlas.json"), "w")
jsonFile.write(json.dumps(atlasDict, indent=2))
jsonFile.close()
<<<<<<< TREE
def csvClean1():
atlasCSV = csv.reader(open(join(PROJECT_ROOT, "../db_csv_files/Atlas.csv"), "r"), delimiter="\t")
=======
>>>>>>> MERGE-SOURCE

View File

@ -108,6 +108,41 @@ class Route(models.Model):
def __unicode__(self):
return self.route
class UniqueRoute(models.Model):
route = models.ForeignKey(Route)
from_stop = models.ForeignKey(Stop, related_name="routes_from")
to_stop = models.ForeignKey(Stop, related_name="routes_to")
distance = models.DecimalField(max_digits=3, decimal_places=2)
is_full = models.BooleanField()
def __unicode__(self):
return "%s: %s to %s" % (self.route.routealias, self.from_stop, self.to_stop,)
class RouteSchedule(models.Model):
unique_route = models.ForeignKey(UniqueRoute)
schedule_type = models.CharField(max_length=16)
busesAM = models.IntegerField(blank=True, null=True)
busesN = models.IntegerField(blank=True, null=True)
busesPM = models.IntegerField(blank=True, null=True)
bus_type = models.CharField(max_length=3, default="SD")
depot = models.ForeignKey("Depot")
first_from = models.TimeField(blank=True, null=True)
last_from = models.TimeField(blank=True, null=True)
first_to = models.TimeField(blank=True, null=True)
last_to = models.TimeField(blank=True, null=True)
runtime1 = models.IntegerField(blank=True, null=True)
runtime2 = models.IntegerField(blank=True, null=True)
runtime3 = models.IntegerField(blank=True, null=True)
runtime4 = models.IntegerField(blank=True, null=True)
headway1 = models.IntegerField(blank=True, null=True)
headway2 = models.IntegerField(blank=True, null=True)
headway3 = models.IntegerField(blank=True, null=True)
headway4 = models.IntegerField(blank=True, null=True)
headway5 = models.IntegerField(blank=True, null=True)
def __unicode__(self):
return "%s: %s" % (unicode(self.unique_route), self.schedule_type,)
class RouteTypes(models.Model):
routecode = models.TextField(max_length=50)
routetype = models.TextField(max_length=50)