I want to return a foreign key field value as the unicode or string method of another model.. like this..
class Schedule(models.Model):
month = models.charField(max_length=20)
.... lots more fields here
def __str__(self):
return related_model.Event.long_name
class Event(models.Model):
schedule = models.Foreignkey(Schedule)
long_name = models.CharField(max_length=100)
I'm not sure how to do it, because if the order of the classes is reversed then Event can't have a foreign key to Schedule.
What would be the correct way to do this kind of thing?