I\'m seeing weird behavior on this code:
images = dict(cover=[],second_row=[],additional_rows=[]) for pic in pictures: if len(images[\'cover\']) == 0:
You assign something new to images['cover']:
images['cover']
images['cover'] = pic.path_thumb_l
where pic.path_thumb_l is None at some point in your code.
pic.path_thumb_l
None
You probably meant to append instead:
images['cover'].append(pic.path_thumb_l)