def extract_attachments(obj) -> list: for attach in obj.attachments.all(): thumb_url = get_timeline_image_thumbnail_url(attach) yield {"id": attach.id, "filename": os.path.basename(attach.attached_file.name), "url": attach.attached_file.url, "thumb_url": thumb_url, "is_deprecated": attach.is_deprecated, "description": attach.description, "order": attach.order}