class Musician(models.Model):
first_name = models.CharField(max_length=50)
last_name = models.CharField(max_length=50)
class Album(models.Model):
artist = models.ForeignKey(Musician, on_delete=models.CASCADE)
name = models.CharField(max_length=100)
- , - . , ( ), (). Album_instance.artist, , Album_instanc, ( ).
Musician_instance.album_set.all()
modelname_set.
, related_name, artist = models.ForeignKey(Musician, on_delete=models.CASCADE, related_name='back')
modelname_set (artist.set) back.
Musician_instance.back.all()
, Django , related_name "+" "+".
related_query_name