I want to save x MediaStreams for one Media Object. So I have a One-to-Many relation here (ForeignKey) but I'm not sure how I can this working as currently always the same stream gets saved and not 5 different ones as expected. Where do I need to place "i" to make this working for object creation within the for-loop?
for i in clean_result['streams']:
new_stream = MediaStreams.objects.create(index=index_value, stream_bitrate=streambitrate_value,
codec_name=codec_name_value, codec_type=codec_type_value,
width=width_value, height=height_value,
channel_layout=channel_layout_value, language=language_value,
media=new_object)
new_stream.save()
Currently only and every time index 5 gets saved and not 0-5 - clean_result['streams']['index'].
Thanks in advance