There are options, but here's what I'd do:
class Stop(models.Model):
name = models.TextField() #use CharField if not using Postgres
latitude = models.DecimalField()
longitude = models.DecimalField()
route = models.ForeignKey('Route')
sequence = models.IntegerField()
class Meta:
I have a `Route` model which should store an ordered list of stops along
that route. How should I go about modeling this relation?
class Stop(models.Model):
name = ..
latitude = ..
longitude = ..
class Route(models.Model):
stops_list = # Ordered list
2 matches
Mail list logo