我正试图获取某些渠道的所有消息:
news = []
channels_in_these_languages = Channel.objects.filter(channel_lang__in=langs)
for each_channel in channels_in_these_languages:
news.append(each_channel.channel_news.all())
channel_news
是每个频道的新闻表related_name
。
但是,循环频道并将每个频道新闻附加到列表中对我来说似乎很难看。有更好的方法吗?