django-cast
django-cast copied to clipboard
Image is Missing When Using Inline Upload
When an image is uploaded through the inline upload form when adding an image in the Wagtail editor, it is missing from the repository on rendering the draft.
@staticmethod
def get_image_and_renditions(image_id: int, context: dict) -> tuple[Image, dict[str, Rendition]]:
repository: HasImagesAndRenditions = context["repository"]
image = repository.image_by_id[image_id] # error
image_renditions = repository.renditions_for_posts.get(image.pk, [])
fetched_renditions = {r.filter_spec: r for r in image_renditions}
return image, fetched_renditions