class Route(models.Model):
start = models.ForeignKey (Location)
destination = models.ForeignKey (Location)
The default related_name clashes here, so I must specify my own:
class Route(models.Model):
start = models.ForeignKey (Location, related_name='starting_points')
finish = models.ForeignKey (Location,
related_name='finishing_points')
In these cases, I always tend to come up with hokey names like above
since the reverse relation doesn't represent anything in the real
domain. Since I know I'll never need to walk the relation backwards,
so it seems like a decision I could avoid making altogether.
Is there a way to express that I don't need the reverse relation?
Thanks,
Joe
No. Even if you don't need them, Django will want to dynamically endow
your Location objects with them. And, as you know, it can't do it if
two reverse relations have the same name.