django-imagekit
django-imagekit copied to clipboard
get_field_info broken on a ProcessedImageField
At least in 4.0.2 imagekit.utils.get_field_info fails to get the instance in a spec associated with a ProcessedImageField. It worked in the past (not sure exactly with which version, unfortunately). Or, is there a different way how to access the current model instance from the associated spec?
Can you give more details (code sample) which can be used to reproduce the issue?
Nothing really fancy, basically just a modified version of the 3.x advanced docs example. In a model:
image = ProcessedImageField(verbose_name=_("image"), default=NO_IMAGE_PATH, upload_to="productimages", autoconvert=None, spec=OptionalWatermarkSpec)
And in the spec:
@property
def processors(self):
instance, field_name = get_field_info(self.source)
And get_field_info is the one from imagekit.utils. However, instance is None under Imagekit 4.0.2 and Django 3.0.4.