o
    &zh+  ã                   @   s*   d dl mZ d dlmZ G dd„ dƒZdS )é    )Úrender_to_string)Úgettext_lazyc                   @   s.   e Zd ZdZedƒZdZd	dd„Zdd„ ZdS )
ÚAdminThumbnailzU
    A convenience utility for adding thumbnails to Django's admin change list.

    Ú	ThumbnailTNc                 C   s   || _ || _dS )zÏ
        :param image_field: The name of the ImageField or ImageSpecField on the
            model to use for the thumbnail.
        :param template: The template with which to render the thumbnail

        N)Úimage_fieldÚtemplate)Úselfr   r   © r	   úI/var/www/html/kangema/venv/lib/python3.10/site-packages/imagekit/admin.pyÚ__init__   s   
zAdminThumbnail.__init__c                 C   sx   t | jƒr|  |¡}nzt|| jƒ}W n ty%   td| j|jjf ƒ‚w t|dd ƒp-|}| jp2d}t||||dœƒS )Nz%The property %s is not defined on %s.Úsourcezimagekit/admin/thumbnail.html)ÚmodelÚ	thumbnailÚoriginal_image)	Úcallabler   ÚgetattrÚAttributeErrorÚ	ExceptionÚ	__class__Ú__name__r   r   )r   Úobjr   r   r   r	   r	   r
   Ú__call__   s    
ÿÿ
ýzAdminThumbnail.__call__)N)	r   Ú
__module__Ú__qualname__Ú__doc__Ú_Úshort_descriptionÚ
allow_tagsr   r   r	   r	   r	   r
   r      s    

r   N)Údjango.template.loaderr   Údjango.utils.translationr   r   r   r	   r	   r	   r
   Ú<module>   s    