1👍
✅
you can get an instance of saved object by
model_obj = Album.objects.get(artist ="Madona")
and after getting an object you can create Song object and save it.
song_obj = Song(album=model_obj, title="SongA")
song_obj.save()
- Django migrations mixed up with 'PROTECT' and 'CASCADE'
- Why doesn't save() automatically call save_m2m()?
- Filtering Many-to-many field in Rest Framework
- Cannot import SubfieldBase from django.db.models import SubfieldBase
Source:stackexchange.com