Commit 45129f6c authored by fred's avatar fred
Browse files

set main_sound property in bulk

parent 7a3935d5
......@@ -64,6 +64,17 @@ class EmissionDetailView(DetailView):
# get all related soundfiles in a single query
soundfiles = {}
for soundfile in SoundFile.objects.filter(podcastable=True,
fragment=False, episode=self.object):
soundfiles[soundfile.episode_id] = soundfile
# replace dynamic property by a static attribute, to avoid database
# lookups
for episode in context['episodes']:
episode.main_sound = soundfiles.get(
return context
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment