def render(self, name, value, attrs=None):
        substitutions = {
            'initial_text': force_text(self.initial_text),
            'input_text': self.input_text,
            'clear_template': '',
            'clear_checkbox_label': self.clear_checkbox_label,
            'ppoi_label': self.ppoi_label
        }
        template = '%(input)s'
        substitutions['input'] = super(ClearableFileInput, self).render(
            name,
            value,
            attrs
        )
        if value and hasattr(value, "url"):
            substitutions['initial'] = format_html('<a href="{0}">{1}</a>',
                                                   value.url,
                                                   force_text(value))
            substitutions['initial_url'] = value.url
            template = self.template_with_initial_and_imagepreview
            point_stage_id = self.get_point_stage_id(name)
            ppoi_id = self.get_ppoi_id(name)
            substitutions['point_stage_id'] = point_stage_id
            substitutions['ppoi_id'] = ppoi_id
            substitutions['image_preview_id'] = self.image_preview_id(name)
            image_preview = self.image_preview(
                name,
                value
            )
            substitutions['image_preview'] = image_preview

            if value.field.blank:
                checkbox_name = self.clear_checkbox_name(name)
                checkbox_id = self.clear_checkbox_id(checkbox_name)
                substitutions['clear_checkbox_name'] = conditional_escape(
                    checkbox_name
                )
                substitutions['clear_checkbox_id'] = conditional_escape(
                    checkbox_id
                )
                substitutions['clear'] = CheckboxInput().render(
                    checkbox_name,
                    False,
                    attrs={'id': checkbox_id}
                )
                substitutions['clear_template'] = self.template_with_clear % \
                    substitutions
        return mark_safe(template % substitutions)
dataset/ETHPy150Open WGBH/django-versatileimagefield/versatileimagefield/widgets.py/ClearableFileInputWithImagePreview.render/original