Untitled
unknown
plain_text
a year ago
517 B
22
Indexable
Never
In [9]: bands = Band.objects.all() In [10]: for band in bands: ...: albums = band.album_set.all() ...: if len(albums) > 0: ...: print("albums for band", band.name) ...: for album in albums: ...: print(" album:", album.title) In [11]: albums = Album.objects.all() In [12]: for album in albums: ...: print("album :", album.title) ...: songs = album.song_set.all() ...: for song in songs: ...: print(" song:", song.title)