Hi, it gives an error:
Unsupported lookup 'stop_id' for CharField or join on the field not permitted.
This is my model structure:
class Stops(models.Model):
stop_id = models.CharField(max_length=100, primary_key=True)
stop_name = models.CharField(max_length=100)
stop_lat = models.TextField()
stop_lon = models.TextField()
location_type = models.CharField(max_length=10, blank=True, null=True)
parent_station = models.CharField(max_length=100, blank=True, null=True)
class Meta:
db_table = 'stops'
class Trips(models.Model):
trip_id = models.CharField(max_length=100, primary_key=True)
route_id = models.ForeignKey(Routes, on_delete=models.CASCADE, db_column='route_id')
service_id = models.ForeignKey(Calendar, on_delete=models.CASCADE, db_column='service_id')
trip_headsign = models.CharField(max_length=100)
direction_id = models.CharField(max_length=100)
shape_id = models.CharField(max_length=100)
class Meta:
db_table = 'trips'
class StopTimes(models.Model):
trip_id = models.ForeignKey(Trips, on_delete=models.CASCADE, db_column='trip_id')
arrival_time = models.CharField(max_length=100)
departure_time = models.CharField(max_length=100)
stop_id = models.ForeignKey(Stops, on_delete=models.CASCADE, db_column='stop_id')
stop_sequence = models.CharField(max_length=100)
class Meta:
db_table = 'stop_times'