django-imagekit icon indicating copy to clipboard operation
django-imagekit copied to clipboard

get_field_info broken on a ProcessedImageField

Open tyrylu opened this issue 4 years ago • 2 comments

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?

tyrylu avatar Apr 06 '20 19:04 tyrylu

Can you give more details (code sample) which can be used to reproduce the issue?

vstoykov avatar Apr 08 '20 01:04 vstoykov

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.

tyrylu avatar Apr 08 '20 08:04 tyrylu