
    hE                        d dl Z d dlZd dlZd dlmZ d dlmZ d dlmZ	 d dl
mZ d dl
mZ d dlmZ d dlmZ d d	lmZ d d
lmZmZmZ d dlmZmZ d dlmZmZmZ d dlmZm Z  d dl!m"Z"m#Z#m$Z$m%Z%m&Z& d dl'm(Z(m)Z) d dl*m+Z+m,Z, d dl-m.Z. d dl/m0Z0 d dl1m2Z2m3Z3 d dl4m5Z5 d dl6m7Z7m8Z8 d dl9m:Z: d dl;m<Z= d dl;m>Z> d dl?m@Z@ ddlAmZ ddlBmCZC ddlmDZDmEZEmFZFmGZGmHZHmIZImJZJ ddlmKZKmLZLmMZMmNZNmOZO ddlPmQZQ ddlRmSZS dd lTmUZU dd!lVmWZW d"d#lAmXZX d"d$lmYZYmZZZm[Z[ d"d%l\m]Z] d"d&l^m_Z_ d"d'lJm`Z`maZambZbmcZcmdZdmeZemfZfmgZgmhZh  eWeK      Zi G d( d)ej                        Zk G d* d+e_      Zly),    N)OrderedDict)quote)unquote)VERSION)forms)settings)messages)helpers)capfirstr   r   )PermissionDeniedValidationError)	EmptyPagePageNotAnInteger	Paginator)modelsrouter)CaseFOuterRefSubqueryWhen)CoalesceLower)HttpResponseHttpResponseRedirect)get_object_or_404)TemplateResponse)pathreverse)	force_str)escapeformat_html)	mark_safe)gettext_lazy)ngettext_lazy)	Thumbnail   )clear_folder_permission_cache)FileFolderFolderPermission
FolderRootImagesWithMissingDataUnsortedImagestools)FILER_IMAGE_MODELFILER_PAGINATE_BYFILER_TABLE_ICON_SIZEFILER_THUMBNAIL_ICON_SIZETABLE_LIST_TYPE)normalize_subject_location)get_delete_permission)FilerActionThumbnailer)
load_model   )views)CopyFilesAndFoldersFormRenameFilesFormResizeImagesForm)get_deleted_objects)"PrimitivePermissionAwareModelAdmin)	AdminContextadmin_url_params_encodedcheck_files_edit_permissionscheck_files_read_permissionscheck_folder_edit_permissionscheck_folder_read_permissionsget_directory_listing_typepopup_statususerperms_for_requestc                   B    e Zd Z ej                         Z G d d      Zy)AddFolderPopupFormc                       e Zd ZeZdZy)AddFolderPopupForm.MetanameN)__name__
__module____qualname__r*   modelfields     G/home/dcms/DCMS/lib/python3.12/site-packages/filer/admin/folderadmin.pyMetarL   :   s    rU   rW   N)rO   rP   rQ   r   HiddenInputfolderrW   rT   rU   rV   rJ   rJ   7   s    U F rU   rJ   c                       e Zd ZdZdZdZdZdgZdgZdZ	g dZ
ed	k\  rd
ZndZg dZdG fd	Zd Z fdZ	 	 dH fd	ZdGdZd Zde_         fdZdIdZdJdZdJdZed        Zd Zd Z fdZd Z ed      e_         d Z!d Z" ed      e"_         d  Z# ed!      e#_         d" Z$ ed#      e$_         d$ Z%d% Z&d& Z'd' Z(d( Z)d) Z*d* Z+d+ Z,d, Z-d- Z. ed.      e._         d/ Z/d0 Z0d1 Z1d2 Z2d3 Z3 ed4      e3_         d5 Z4d6 Z5d7 Z6d8 Z7d9 Z8d: Z9d; Z: ed<      e:_         d= Z;d> Z<d? Z=d@ Z>dA Z?dB Z@dC ZAdD ZBdE ZC edF      eC_          xZDS )KFolderAdminrM   parentd   ownerrN   r`   T)delete_files_or_foldersmove_files_and_folderscopy_files_and_foldersresize_imagesrename_files)   r'   z)admin/filer/folder/directory_listing.htmlz&admin/filer/folder/legacy_listing.html)
_file_sizeoriginal_filenamerN   r`   uploaded_atmodified_atc                      j                   j                  dd      }|sj                  j                  dd      }|rt        S t	           fddi|} fd}||_        |S )zw
        Returns a Form class for use in the admin add view. This is used by
        add_view and change_view.
        	parent_idNobjc                 @   | j                   }j                        j                  | j                  j                  |d         }| j                  j
                  r&|j                  | j                  j
                        }|j                         rt        d      |S )NrN   )r]   rN   pkz%Folder with this name already exists.)	cleaned_dataget_querysetfilterinstancer]   rp   excludeexistsr   )form_objrq   folders_with_same_namerequestselfs      rV   folder_form_cleanz/FolderAdmin.get_form.<locals>.folder_form_clean`   s    '44)-):):7)C)J)J#,,33%f- *K */& $$''-C-K-K#,,// .L .1*)002)?A A##rU   )GETgetPOSTrJ   superget_formclean)rz   ry   rm   kwargsrl   folder_formr{   	__class__s   ``     rV   r   zFolderAdmin.get_formR   sr    
 KKOOK6	((d;I%%'*-!-%+-K$ !2KrU   c                     |st        |j                         |j                  d      }|j                  j	                  dd      }|s|j
                  j	                  dd      }|r(| j                  |      j	                  |      }||_        |S )z
        Given a ModelForm return an unsaved instance. ``change`` is True if
        the object is being changed, and False if it's being added.
        F)commitrl   Nid)r(   usersaver|   r}   r~   rr   r]   )rz   ry   formchangerrl   r]   s          rV   	save_formzFolderAdmin.save_formq   s}    
 )',,7IIUI#KKOOK6	((d;I&&w/33y3AFAHrU   c                 R   |j                   rd|j                   vr}d|j                   vrod|j                   vra|j                  r$t        dd|j                  j                  i      }nt        d      }dj	                  |t        |            }t        |      S t        | !  ||      S )	z
        Overrides the default to be able to forward to the directory listing
        instead of the default change_list_view
        	_continue
_saveasnew_addanotheradmin:filer-directory_listing	folder_idr   "admin:filer-directory_listing-root{}{})	r~   r]   r   r   formatrA   r   r   response_change)rz   ry   rm   urlr   s       rV   r   zFolderAdmin.response_change   s     LL7<</GLL0W\\1 zz=&13::==%AC BC--(1C (,,w&w44rU   c                    | j                   j                  j                  | j                   j                  j                  f}dd|z  t	        |      t        |      d}|j                  |       t        	| !  ||||||      S )NTzadmin:%s_%s_history)show_deletehistory_urlis_popupfiler_admin_context)ry   contextaddr   form_urlrm   )	rR   _meta	app_label
model_namerG   r@   updater   render_change_form)
rz   ry   r   r   r   r   rm   infoextra_contextr   s
            rV   r   zFolderAdmin.render_change_form   s    zz))4::+;+;+F+FF(,(=(D%1'%:0<W0EG 	}%w)W#H# * 7 	7rU   c                    	 | j                  |      j                  t        |            }|j                  }|j                  r| j                  |t        j                  j                         | j                  |      j                  |             |rt        dd|j                  i      }nt        d      }d	j                  |t        |            }t!        |      S | j                  |t        j                  j                         | j                  |      j                  |            S # | j                  j
                  $ r d}Y w xY w)
a  
        Overrides the default to enable redirecting to the directory view after
        deletion of a folder.

        we need to fetch the object and find out who the parent is
        before super, because super will delete the object and make it
        impossible to find out the parent folder to redirect to.

        The delete_view breaks with polymorphic models if the cascade will
        try delete objects that are of different polymorphic types
        (AttributeError: 'File' object has no attribute 'file_ptr').
        The default implementation of the delete_view is hard to override
        without just copying the whole big thing. Since we've already done
        the overriding work on the delete_files_or_folders admin action, we
        can re-use that here instead.
        ro   Nr   files_querysetfolders_querysetr   r   r   r   r   )rr   r}   r   r]   rR   DoesNotExistr~   ra   r)   objectsnoners   r   r   r   rA   r   )rz   ry   	object_idr   rm   parent_folderr   s          rV   delete_viewzFolderAdmin.delete_view   s9   "	!##G,00GI4F0GCJJM <<((#||002!%!2!27!;!B!Bi!B!P ) 
 =&1=3C3C%DF BC--(1C (,,++<<,,.!..w7>>)>L , 
 	
) zz&& 	! M	!s   6D/ /EEc                 6    t        dt        j                        S )Nz6<img src="filer/icons/folder.svg" alt="Folder Icon" />)r"   django_settingsSTATIC_ROOT)rz   xss     rV   icon_imgzFolderAdmin.icon_img   s    SUdUpUpqqrU   c                    t        d| j                  j                  | j                        d      t        d| j                  j                  | j                        ddid      t        d| j                  j                  | j                        d	      t        d
| j                  j                  t        j
                        d      t        d| j                  j                  t        j
                        d      t        d| j                  j                  | j                        ddid      t        d| j                  j                  | j                        ddid      gt        |          z   S )N zfiler-directory_listing-rootrM   zlast/viewtypelastzfiler-directory_listing-lastz<int:folder_id>/list/zfiler-directory_listingz<int:folder_id>/make_folder/z#filer-directory_listing-make_folderzmake_folder/z(filer-directory_listing-make_root_folderzimages_with_missing_data/images_with_missing_dataz0filer-directory_listing-images_with_missing_datazunfiled_images/unfiled_imagesz&filer-directory_listing-unfiled_images)r   
admin_site
admin_viewdirectory_listingr:   make_folderr   get_urls)rz   r   s    rV   r   zFolderAdmin.get_urls   sS    ++D,B,BC46 ++D,B,BCf%46
 (++D,B,BC/1 /++E,=,=>;= ++E,=,=>@B ,++D,B,BC89HJ
 "++D,B,BC./>@9 
@ GA   	rU   c                    |j                   j                  d      s
t               t        j                  |j                         }|dk(  rt               }n|dk(  rt        |j                         }n|dk(  rf|j                  j                  d      }	 | j                  |      j                  |       t        dd	|i
      }| t        |       }t        |      S |t               }nt!        | j                  |      |      }||j                  d<   t#        |      xs t$        j&                  }|t(        k(  r%t*         dt*         }	dt*        z   ddt*        z   }
n$t,         dt,         }	dt,        z   ddt,        z   }
| j/                  |      }t1        | j2                        }|s	 |j5                  d       |j8                  j                  d      }|rt;        |      j=                  d      }d}ng }d}d}|j8                  j                  dd      dv }t?        |      dkD  r|rm|rk|j@                  s_|jC                         }tD        jF                  jI                  |      }tJ        jF                  jI                  ||jL                  gz         }n/| j                  |      }tJ        jF                  jO                         }| jQ                  ||      jS                  dd      }| jU                  ||      }d}n6|jV                  jO                         }|jX                  jO                         }d}|j[                  d      j]                  d      }|j8                  j                  dd       }d }|5t_        ta        tc        te        dd       te        dd            d             }|r|j=                  d!      ng }|D cg c]'  }tg        jh                  d"d|      | jj                  v r|) }}t?        |      dkD  r |jZ                  | }n|r|j[                  |      }|j@                  r|s|jl                  }ng }tn        jF                  jq                  |j                         }|d#k7  r|jI                  ts        jt                  |$      ts        jt                  d%      z  ts        jt                  |j                   &      z        }|jI                  ts        jt                  |'      ts        jt                  |j                   &      z        }d|d(}nd)di}|j@                  r |jv                  dhi |}tx        jF                  jI                  t{        d*      t}        d+      ,      jw                  d-.      j[                  d/      }|j                  t        |jI                  d0|	 d1.      j                  d      d d2       t        |jI                  d0|
 d1.      j                  d      d d2       3      j]                  d      }	 |j                  |      |j                  |      |j                  |      d4}t1        t        j                  ||            }t        |t              }|j                  d5k(  rd6|j                  vr|D ]  }d7|j                  fz  |j                  v s t        j                  |j                         }|j                  |      r2t        j                  |g|       t        |j                               c S t         |j                  j                  t        j                        } |rb|j                  d5k(  rSd8|j                  v rEd6|j                  vr7| r| j                  |||9      }!|!r|!S t        d:      }"| j                  ||"       |ra|j                  d5k(  rRt        j                  |j                  v r6d8|j                  vr(d6|j                  vr| r| j                  |||9      }!|!r|!S |r6| j                  d ;      }#| j                  |      |#j                  d<   _W        nd }#t        d=d>|j                        }$	 |j                  |j8                  j                  d?d2            }%| j                  j                  |      }&|&j                  i d@|dAtJ        jF                  jI                  |j                   B      j                         dC|dD|%dE|dFt$        j                  dGt$        j                  dHt$        j                  dI|dJt        ||      dK|j                  dLt        dM      dN|j                  iz  dOdj                  |      dt        |      dP|dQ|dR|i dS|t(        k(  rt*        nt,        d|dTt        |      dUt        |      dVt        dW      dX|#dY| j                  dZ| j                  d[| j                  d\t        d]      d^t?        |%j                        iz  d_|$d`|j                  iz  da|dbt$        j                  |   dc   dd| j                  det$        j                  df|j                   j                  xs1 |j@                  xr t$        j                  xs |j                  dg             t        || j                  |&      S # | j                  j                  $ r' t        d      }| t        |       }Y t        |      S w xY w# t6        $ r Y 	Nw xY wc c}w #  i }Y xY w# t        $ r |j                  d2      }%Y t        $ r |j                  |j                        }%Y w xY w)iNzfiler.can_use_directory_listingr   r   )r   r   filer_last_folder_idr   r   r   r   r   xr'   action_checkboxq Tr   Flimit_search_to_folder)Tonr   pk__in)folder_id__inchildren	all_filesrN   r`   order_by)name__exactthen)name__isnullr   rh   ,z^-All)folder__id__in)folder_id__isnullr_   )id__in)parent__isnullparent__id__inr   filesource__modified)source__namemodified__gteupscale)name__containsz	-modified___r9   )thumbnail_namethumbnailx2_name)has_edit_permissionhas_read_permissionhas_add_children_permissionr~   _savezmove-to-clipboard-%dindexr   WItems must be selected in order to perform actions on them. No items have been changed.auto_idactionz%(total_count)s selectedzAll %(total_count)s selectedpagerY   clipboard_files)-in_clipboards__clipboarditem__clipboard__user	paginatorpaginated_itemsvirtual_itemsuploader_connections	max_filesmax_filesizepermissions	permstestcurrent_urltitlez%Directory listing for %(folder_name)sfolder_namesearch_stringshow_result_countfolder_childrenfolder_filesthumbnail_sizer   r   	root_pathadmin:indexaction_formactions_on_topactions_on_bottomactions_selection_counterselection_notez0 of %(cnt)s selectedcntselection_note_alltotal_count	list_typelist_type_templatetemplatemediaenable_permissionscan_make_folderr   rT   )wr   has_permr   r/   get_user_clipboardr-   r.   sessionr}   rr   r   rA   rR   r   r   r,   r   rF   r   $FILER_FOLDER_ADMIN_DEFAULT_LIST_TYPEr4   r2   r3   get_actionslistlist_displayremove
ValueErrorr|   
urlunquotesplitlenis_rootget_descendants_idsr*   r   rs   r)   rp   allfilter_folderprefetch_relatedfilter_filer   filesr   select_relatedr   r   r   r   resuborder_by_file_fieldsvirtual_foldersr+   get_read_id_listr   Qru   r&   r   r   annotater   values_listr   r   r   	itertoolschainr   r1   methodr~   r   move_file_to_clipboardget_full_pathgetlistr
   ACTION_CHECKBOX_NAMEresponse_actionr   message_userr  get_action_choicesrS   choicesr%   countr   r   r   	num_pagesr   each_contextr   distinctFILER_UPLOADER_CONNECTIONSFILER_UPLOADER_MAX_FILESFILER_UPLOADER_MAX_FILE_SIZErH   r   rN   joinurlquoterG   r@   r  r  r  object_list.FILER_FOLDER_ADMIN_LIST_TYPE_SWITCHER_SETTINGSr  FILER_ENABLE_PERMISSIONSis_superuser-FILER_ALLOW_REGULAR_USERS_TO_ADD_ROOT_FOLDERSr   directory_listing_template)'rz   ry   r   r   	clipboardrY   last_folder_idr   r  sizesize_x2actionsr  r   search_termssearch_moder   desc_folder_ids	folder_qsfile_qsr   r   order_by_annotationfieldr   permsroot_exclude_kwargsthumbnail_qsr   itemsr   fselectedresponsemsgr  r
  r   r   s'                                          rV   r   zFolderAdmin.directory_listing   s   ||$$%FG"$$,,W\\:	11*,F)) $6F$__001GHNB!!'*....A
 ={TbFcd6w?@A',,\F&t'8'8'AiPF2;./.w7h8;h;h	'+,A.C-DED2231Q9N5N4OPG 002K1LMD667q=V9V8WXG ""7+ D--.##$56
 KKOOC %a=..s3LKLAK!(1I16"8;G"H |q 0"("<"<">"NN111I	 ,,--Ovyyk<Y-Z --g6	,,**,**9lCTTU_almI&&w=G $++-Ill&&(G %&&v.==gF	;;??:t4""'Rd3e&9 $) # +38>>#&'/ NevveR/43L3LL  N Nx=1&g&&1G &&':;G>>+"22MM ((99',,GE>nn.((T23((./G
 "(()?&((QXQ]Q]B^)^_I5:e"T#3U";>>)	))@,?@I V%f- 23   WIW.Xk" 	 ""#L$7$7D6QR|$7$T$`$`ag$hikjk$lm%l&9&92gYVW&9&Y&e&efl&mnpop&qr # 
 .
! 	
	'-'A'A''J'-'A'A''J66w?	K Y__Y89e%67	 >>V#w||(C /)QTTG3w||C % 8 8 FI,,W544aS)D3G4I4I4KLL../ <<''(D(DE &07<<'w||+//bk/l#O G H!!'3/ &0,,<w||+w||+//bk/l#O **4*8K373J3J73SKx(0K*+E*IOO=	B'nnW[[__VQ-GHO //..w7 %
f%
t||22>Ell  3  hj	%

 %
 %
 ]%
 #H$G$G%
 ::%
 HAA%
 ;%
 .vw?%
 7<<%
 Q>?=RXR]R]B^^%
 SXXl3%
  !!%
"  !2#%
$ y%%
& G'%
( yO7S3Yr)%
* %&<+%
, W--%
. "<#8/%
2 /3%
4 ;5%
6 d117%
8  !7!79%
: ()G)G;%
< a 78E3GbGbCc;dd=%
> !"4y7W"W?%
@ A%
B !("Y"YZc"deo"pC%
D TZZE%
F !("C"CG%
H w||88   zV^^  >GPX  QG  QG   z  LW  L[  L[  \y  LzI%
 %	L  )H)H'RRO ::** BBC6w?@A (,,B>  bN`	Kt   	0'nnQ/O 	B'nnY-@-@AO	BsN   !j< ,k? ,l
3l +l <3k<;k<?	lllm";#m"!m"c           
      $   d }|D ]  }t        j                         }| j                  D ]"  }|t        j                  di  ||      |iz  }$ | j                         D ]  }|t        j                  di ||iz  } |j	                  |      } |S )Nc                     | j                  d      rd| dd  z  S | j                  d      rd| dd  z  S | j                  d      rd| dd  z  S d| z  S )	N^z%s__istartswithr9   =z
%s__iexact@z
%s__searchz%s__icontains)
startswith)
field_names    rV   construct_searchz3FolderAdmin.filter_folder.<locals>.construct_search  sj    $$S)(:ab>99&&s+#jn44&&s+#jn44&33rU   rT   )r   r+  search_fieldsget_owner_filter_lookupsrs   )rz   qstermsrc  termfiltersfilter_s          rV   r!  zFolderAdmin.filter_folder  s    	4  	$DhhjG-- I688H'7'@$&GHHI88: 76886wo6677#B	$ 	rU   c           	         |D ]  }t        j                  |      t        j                  |      z  t        j                  |      z  }| j                         D ]  }|t        j                  di ||iz  } |j                  |      } |S )N)name__icontains)description__icontains)original_filename__icontainsrT   )r   r+  re  rs   )rz   rf  rg  rh  ri  rj  s         rV   r#  zFolderAdmin.filter_file  s     	$Dxx5>?tDEG  88: 76886wo6677#B	$ 	rU   c                     ddl m}  |       }|j                  j                  D cg c]7  }t	        |t
        j                        r|j                  dk7  r|j                  9 c}S c c}w )z
        Returns all the fields that are CharFields except for password from the
        User model.  For the built-in User model, that means username,
        first_name, last_name, and email.
        r   )get_user_modelpassword)django.contrib.authrp  r   rS   
isinstancer   	CharFieldrN   )rz   rp  UserrS  s       rV   owner_search_fieldszFolderAdmin.owner_search_fields  sZ     	7 %)JJ$5$5
 %!1!12uzzZ7O JJ
 	
 
s   <A%c                 H    | j                   D cg c]  }d| d
 c}S c c}w )Nowner____icontains)rv  )rz   rS  s     rV   re  z$FolderAdmin.get_owner_filter_lookups!  s3     11
 eWK(
 	
 
s   c                 r   	 t        |j                  j                  dd            }|j                  j	                         }|j                  t        j                  d       |j                  dd       	 |j                  d|j                  d      |   i       | j                  |d      }| j                  |      |j                  d   _        |j                         r|j                   d   }|j                   d   }| j#                  |      |   \  }	}
}|j                  j                  t        j                        }|s |st%        d      }| j'                  ||       y|s`g }g }|D ]3  }|dd d	k(  r|j)                  |dd         |j)                  |d
d        5 |j+                  |      }|j+                  |      } |	| |||      }t-        |t.              r|S t1        |j3                               S t%        d      }| j'                  ||       y# t        $ r d}Y w xY w# t        $ r Y w xY w)z
        Handle an admin action. This is called if a request is POSTed to the
        changelist; it returns an HttpResponse if the action was handled, and
        None otherwise.
        r   r   Nr   r   select_acrossr   rf   zfile-   r   zNo action selected.)intr~   r}   r  copypopr
   r4  r   r3  
IndexErrorr  r7  rS   r8  is_validrq   r  r   r6  appendrs   rs  r   r   r2  )rz   ry   r   r   action_indexdatar  r   r{  funcrN   descriptionrY  r[  selected_filesselected_foldersrp   rZ  s                     rV   r5  zFolderAdmin.response_action'  sE   	w||//;<L
 ||  "--t4$	KK4<<#9,#GHI &&tT&:/3/F/Fw/O8$, ! --h7F'44_EM&*&6&6w&?&G#D$
 ||++G,H,HIHM  G H!!'3/ !##% " 8B"1v(&--bf5(//127	8 "0!6!6n!6!M#3#:#:+ $; $-  D'>;KLH
 (L1+G,A,A,CDD)*Cgs+C  	L	  	 		s#   %H 4%H) H&%H&)	H65H6c                     t         j                  rQt               }| j                  d      |d<   | j                  d      |d<   |j	                  t
        |   |             nt
        |   |      }d|v r|d= |S )Nfiles_set_publicfiles_set_privatedelete_selected)r   rD  r   
get_actionr   r   r  )rz   ry   rL  r   s      rV   r  zFolderAdmin.get_actionsv  sx    ,,!mG*.//:L*MG&'+/??;N+OG'(NN57.w78g)'2G')*rU   c                 L   | j                  |      st        |j                  dk7  ryt        j                  |j
                        t        ||       t        ||       dgfdfd |        |       | j                  |t        d      dd   iz         y)zk
        Action which moves the selected files and files in selected folders
        to clipboard.
        r~   Nr   c                 H    dxx   t        j                  |       z  cc<   y Nr   )r/   r1  )r$  rH  files_counts    rV   
move_filesz1FolderAdmin.move_to_clipboard.<locals>.move_files  s    Ne::5)LLNrU   c                 x    | D ]4  } |j                           |j                  j                                6 y Nr$  r   r   )foldersrX  r  move_folderss     rV   r  z3FolderAdmin.move_to_clipboard.<locals>.move_folders  s1     /177#QZZ^^-./rU   z0Successfully moved %(count)d files to clipboard.r9  )
has_change_permissionr   r0  r/   r  r   rB   rD   r6  r   )rz   ry   r   r   rH  r  r  r  s       @@@@rV   move_to_clipboardzFolderAdmin.move_to_clipboard  s     ))'2"">>V#,,W\\:	$Wn=%g/?@ c	M	/
 	>"%&'1 &2 $36={1~5N$O 	P rU   z Move selected files to clipboardc                 ~   | j                  |      st        t        j                  }|j                  dk7  s|syt        ||       t        ||       dgfdfd |        |       r$| j                  |t        d      dd   iz         y| j                  |t        d      dd   iz         y)	z
        Action which enables or disables permissions for selected files and
        files in selected folders to clipboard (set them private or public).
        r~   Nr   c                 |    | D ]6  }|j                   k7  s|_         |j                          dxx   dz  cc<   8 y Nr   r9   )	is_publicr   )r$  rX  r  
set_publics     rV   	set_filesz:FolderAdmin.files_set_public_or_private.<locals>.set_files  s<     (;;*,",AKFFHNa'N	(rU   c                 x    | D ]4  } |j                           |j                  j                                6 y r  r  )r  rX  r  set_folderss     rV   r  z<FolderAdmin.files_set_public_or_private.<locals>.set_folders  s1     .!''"AJJNN,-.rU   z6Successfully disabled permissions for %(count)d files.r9  z5Successfully enabled permissions for %(count)d files.)	r  r   r   rD  r0  rB   rD   r6  r   )	rz   ry   r  r   r   permissions_enabledr  r  r  s	     `   @@@rV   files_set_public_or_privatez'FolderAdmin.files_set_public_or_private  s     ))'2""&??>>V#+>$Wn=%g/?@ c	(	.
 	.!$%gq)a'bfmoz{|o}  fA  (A  B  gq)`'aelnyz{n|d'  ArU   c                 *    | j                  |d||      S NFr  rz   ry   r   r   s       rV   r  zFolderAdmin.files_set_private  s     //0@B 	BrU   z%Enable permissions for selected filesc                 *    | j                  |d||      S )NTr  r  s       rV   r  zFolderAdmin.files_set_public  s     //~0@B 	BrU   z&Disable permissions for selected filesc                    | j                   j                  }|j                  }| j                  |      st        | j                  |||      }g }t        j                  | j                         }t        ||j                   j                  |j                  | j                  |      \  }	}
}}t        ||j                   j                  |j                  | j                  |      \  }}}}|j                  |       |j                  |       |	|g}|j                  |      }|j                  j                  d      r|rt        |j                         |j                         z   }|rt         dk\  r*| j#                  ||       |D ]  }|j%                           n3|D ].  }| j'                  ||t)        |             |j%                          0 t+               }|D ]<  }|j-                  |j.                         |j1                  |j3                                > t         dk\  rJt4        j6                  j9                  |      }| j#                  ||       |D ]  }|j%                           nQt4        j6                  j9                  |      D ].  }| j'                  ||t)        |             |j%                          0 t         dk\  r#| j#                  ||       |j%                          n3|D ].  }| j'                  ||t)        |             |j%                          0 | j;                  |t=        d      d|iz         y|s|rt=        d      }nt=        d      }| j                  j?                  |      }|j1                  ||t=        d	      ||||||tA        |      tC        |      tE        d
      |tF        jH                  d       tK        |d|      S )a  
        Action which deletes the selected files and/or folders.

        This action first displays a confirmation page whichs shows all the
        deletable files and/or folders, or, if the user has no permission on
        one of the related childs (foreignkeys), a "permission denied" message.

        Next, it deletes all selected files and/or folders and redirects back to
        the folder.
        post)rf   r9   )
folder__inz4Successfully deleted %(count)d files and/or folders.r9  Nz"Cannot delete files and/or folderszAre you sure?zDelete files and/or foldersr  )r   rt   breadcrumbs_actiondeletable_objectsr   r   perms_lacking	protectedoptsr   r   r  r   action_checkbox_namez3admin/filer/delete_selected_files_confirmation.html)&rR   r   r   has_delete_permissionr   _get_current_action_folderr   db_for_writer>   r   r   extendunionr~   r}   r9  DJANGO_VERSIONlog_deletionsdeletelog_deletionr    setr   r   r   r  r)   r   rs   r6  r   r;  rG   r@   r   r
   r4  r   )rz   ry   r   r   r  r   current_folderall_protectedusingdeletable_filesmodel_count_filesperms_needed_filesprotected_filesdeletable_foldersmodel_count_folderperms_needed_foldersprotected_foldersall_deletable_objectsall_perms_needednrX  
folder_idsrY   rf  r   r   s                             rV   ra   z#FolderAdmin.delete_files_or_folders  s     zzNN	 ))'2""88^%57  ##DJJ/Reft  wE  wK  wK  wQ  wQ  SZ  S_  S_  ae  ap  ap  rw  SxO*,>Ylm}  @P  @V  @V  @\  @\  ^e  ^j  ^j  lp  l{  l{  }B  ZCV-/CEV_-./!02C D-334HI <<F#&&$$&)9)?)?)AAA!V+&&w?+ #
# , #))'1ilC
# !U
. DFNN699-%%f&@&@&BCD "V+,,
,CB&&w3 #
# "\\00J0G #))'1ilC
# "V+&&w?$++-- #))'1ilC
# !!'1-c+dhoqrgu+uv}:;Eo&E//..w7&"#$A"B!6, 0-&$W-#/#8 /"$+$@$@
 	$  A
 	
rU   z$Delete selected files and/or foldersc                    |j                   |j                  v }|j                  }|rt        |j                  d|j
                  d|j                  j                         dd t        |j                               f      }t        |      }|j                  |      s|j                  |j                         t        dt        t!        |j                              |t        |            S t!        |j                         dt#        |       S )N:r   _changez{}: <a href="{}">{}</a>z: )r   	_registryr   r   rN   r   object_namelowerr   _get_pk_valr6   r  r   verbose_namer"   r!   r   r    )	rz   rm   r   r   perms_needed	has_adminr  	admin_urlps	            rV   _format_callbackzFolderAdmin._format_callbackY  s    MMZ%9%99	yy#-??#'>>#'#3#3#9#9#;!= !%uS__->'?&A	CI
 &d+A==#  !2!238&$J[J[A\:]_hjpqtjuvv t0012"Ys^4DEErU   c                 T    	 t        ||       t        ||       y# t        $ r Y yw xY wNTF)rC   rE   r   r  s       rV   _check_copy_permszFolderAdmin._check_copy_permsl  s5    	(.A)'3CD    		s    	''c                     	 t        ||       t        ||       t        ||       t        ||       y# t        $ r Y yw xY wr  )rC   rE   rB   rD   r   r  s       rV   _check_move_permszFolderAdmin._check_move_permst  sJ    	(.A)'3CD(.A)'3CD    		s   03 	??c                 H    |r|d   j                   S |r|d   j                  S y r  )rY   r]   r  s       rV   r  z&FolderAdmin._get_current_action_folder~  s-    !!$+++#A&---rU   c              #     K   |D ]  }| j                  ||j                  | j                  t                      t	        | j                  ||j                  j                                     }|j                  t        |j                        D cg c]2  }| j                  ||j                  | j                  t                     4 c}       |s|  y c c}w wr  )r  r   r   r  r  _list_folders_to_copy_or_mover   r   r  sortedr$  rz   ry   r  for   rX  s         rV   r  z)FolderAdmin._list_folders_to_copy_or_move  s      	B''GLL$//35QQD>>wHYZ[HOOeklnltlteuv`aT221gllDOOUXUZ[vw	 ws   BC7C
	CCc                     t        | j                  ||            }|j                  t        |      D cg c]2  }| j	                  ||j
                  | j                  t                     4 c}       |S c c}w r  )r  r  r  r  r  r   r   r  )rz   ry   r   r   to_copy_or_moverX  s         rV   _list_all_to_copy_or_movez%FolderAdmin._list_all_to_copy_or_move  sg    tAA'K[\]hno}h~cd 5 5atX[X] ^  	A  @s   7A4c           
   #   :  K   |D ]  }|s||v r
|j                  |      s|xs ||k7  xr |j                  |      }|t        d|z  t        |      z         |ff | j	                  ||||j
                  j                         ||dz         E d {     y 7 w)Nz&nbsp;&nbsp;r9   )r   r   r#   r    '_list_all_destination_folders_recursiver   r   )	rz   ry   r   r  r  
allow_selflevelr  enableds	            rV   r  z3FolderAdmin._list_all_destination_folders_recursive  s      	YB"(8"8))'2 "9R>%9fr?]?]^e?fG	>E#9Yr]"JKWUVVCCGM]_moqozozo~o~  pA  CM  OT  WX  OX  Y  Y  Y	Y Ys   BBBBc           
          | j                  |      j                  d      j                  d      }t        | j	                  |||||d            S )NT)r   rN   r   )rr   rs   r   r  r  )rz   ry   r   r  r  root_folderss         rV   _list_all_destination_foldersz)FolderAdmin._list_all_destination_folders  sb    ((1888MVVW]^D@@JZ\jlx  {E  GH  I  J  	JrU   c                 L    |j                  |       |j                  |       y )NrY   r\   )r   )rz   r   r   destinations       rV   _move_files_and_folders_implz(FolderAdmin._move_files_and_folders_impl  s$    [1{3rU   c                    | j                   j                  }|j                  }| j                  |||      }| j	                  |||      }| j                  |||      }| j                  |||d      }	|j                  dk(  rP|j                  j                  d      r4|rt        	 | j                  |      j                  |j                  j                  d            }
t        |	      }|
|vs||
   d   st        |j                         |j                         z   }| j                  |      j                  |
|j!                  d            D cg c]  }|j"                   }}|r2t%        j&                  |t)        d	      d
j+                  |      z         y |r4| j-                  |||
       | j/                  |t)        d      ||
dz         y | j0                  j3                  |      }|j5                  t)        d      |t)        d      ||	||||t7        d      |t8        j:                  d       t=        |d|      S # | j                   j                  $ r t        w xY wc c}w )NFr~   r  r  ro   r9   rN   )r]   name__inz?Folders with names %s already exist at the selected destinationz, zNSuccessfully moved %(count)d files and/or folders to folder '%(destination)s'.r9  r  zMove files and/or foldersr  )r   rt   r  to_movedestination_foldersr   r   r  r  r  r   r  z/admin/filer/folder/choose_move_destination.html)rR   r   r   r  r  r  r  r0  r~   r}   r   rr   r   dictr9  rs   valuesrN   r	   errorr   r@  r  r6  r   r;  r   r   r
   r4  r   )rz   ry   r   r   r  r   r  r  r  r  r  folders_dictr  rY   conflicting_namesr   s                   rV   rb   z"FolderAdmin.move_files_and_folders  s   zzNN	88.Rbc--g~GWX00.JZ[44W>NP^`ef>>V#(8(8(@&&'"//8<<@P@PQ^@_<`  =L,.l;6OPQ6R&&$$&)9)?)?)AAA;?;L;LW;U;\;\do  {K  {R  {R  SY  {Z;\  <[  !\  !\  !\ w +8 )9;?99EV;W)X Y  11.BRT_`!!'1-}+~#.B ,  //..w723&"#$?"@#*, 0) /"$+$@$@
 	   )Z\cddI ::** '&&' !\s   %:H? I"? Iz"Move selected files and/or foldersc                    t         j                  j                  |j                        \  }}|j                  r-t         j                  j                  |j                        \  }}nd}d}|d   |j                  |||j                  xs d||t        |j                  dd      |dz   |dz   d	z  |_        |j                          y )Nr   rename_formatrN   r9   )	rh   original_basenameoriginal_extensioncurrent_filenamecurrent_basenamecurrent_extensionr  counterglobal_counter)osr   splitextrh   rN   getattrrY   r   )	rz   file_obj	form_datar  r  r  r  r  r  s	            rV   _rename_filezFolderAdmin._rename_file  s    020@0@A[A[0\--==24''2B2B8==2Q//! "!/2!)!;!;!2"4 ( 3 0!2%hoovrB{,q0
6
 

 	rU   c                 b    d}t        |      D ]  }| j                  |||||z          |dz  }  |S r  )r  r
  )rz   r$  r	  r  r  rX  s         rV   _rename_fileszFolderAdmin._rename_files  sC     	AaA~/ABFA	 rU   c                     | j                  |j                  j                         |j                  j                         ||      S r  )_rename_files_implr$  r   r   )rz   rY   r	  r  s       rV   _rename_folderzFolderAdmin._rename_folder  s5    &&v||'7'7'96??;N;N;PR[]kllrU   c                 |    d}|D ]  }|| j                  ||||z         z  } || j                  ||||z         z  }|S r  )r  r  )rz   r   r   r	  r  r  rX  s          rV   r  zFolderAdmin._rename_files_impl  s[    ! 	GA$$Q	>A3EFFA	G 	
T	>A;MNNrU   c                    | j                   j                  }|j                  }| j                  |||      }| j	                  |||      }| j                  |||      }|j                  dk(  r|j                  j                  d      r|rt        t        |j                        }	|	j                         rj|j                         |j                         z   r>| j                  |||	j                  d      }
| j                  |t!        d      d|
iz         y t               }	| j"                  j%                  |      }|j'                  t!        d      |t!        d      ||	||||t)        d      |t*        j,                  d       t/        |d	|      S )
Nr~   r  r   z%Successfully renamed %(count)d files.r9  Rename filesr  )r   rt   r  	to_renamerename_formr   r   r  r  r  r   r  z,admin/filer/folder/choose_rename_format.html)rR   r   r   r  r  r  r0  r~   r}   r   r<   r  r9  r  rq   r6  r   r   r;  r   r   r
   r4  r   )rz   ry   r   r   r  r   r  r  r  r   r  r   s               rV   re   zFolderAdmin.rename_files  sv   zzNN	88.Rbc--g~GWX227NL\]	>>V#(8(8(@&&"7<<0D}}!''),<,B,B,DD//@PRVRcRcefgA%%gq1X/Y] 0  "$D//..w7~&&"#N"3", 0) /"$+$@$@
 	   )WY`aarU   r  c                 V    t         j                  j                  |      \  }}||z   |z   S r  )r  r   r  )rz   filenamesuffixbasename	extensions        rV   _generate_new_filenamez"FolderAdmin._generate_new_filename3  s+     gg..x8)& 9,,rU   c                 F   |rt         | j                  |j                  j                  |      }d |_        d |_        |j                          ||_        d|_        |j                  |      |_        | j                  |j                  |      |_
        |j                          y r  )NotImplementedErrorr  r   rN   rp   r   r   rY   _file_data_changed_hint
_copy_filerh   )rz   r  r  r  	overwriter  s         rV   r  zFolderAdmin._copy_file7  s    %% ..x}}/A/A6J %+0( ++H5%)%@%@A[A[]c%d"rU   c                 N    |D ]  }| j                  ||||        t        |      S r  )r  r  )rz   r$  r  r  r  rX  s         rV   _copy_fileszFolderAdmin._copy_filesJ  s-     	?AOOA{FI>	?5zrU   c                     t        j                  d      }|}|j                  |      r"| dt        |       }|j                  |      r"|S )Nr9   r   )r.  r9  contains_foldernext)rz   r  rN   r9  originals        rV   _get_available_namezFolderAdmin._get_available_nameO  sL    "))$/Zqe.D ))$/rU   c                     |rt         | j                  ||j                        }t        j                  j                  |j                        }t        j                  j                  ||j                  |      \  }}t        j                  j                  |      D ]'  }d |_        d |_        ||_        |j                          ) d| j                  |j                  j!                         |j"                  j!                         |||      z   S )Nro   )rN   r`   r]   r  r9   )r  r&  rN   r*   r   r}   rp   get_or_creater`   r+   rs   r   rY   r   _copy_files_and_folders_implr$  r   r   )	rz   rY   r  r  r  
foldername
old_folderr   perms	            rV   _copy_folderzFolderAdmin._copy_folderV  s    %%
 --k6;;G
^^''699'5
NN00"" 1 
	 %,,33:3F 	DDGDG DKIIK		 444Z5E5E5I5I5KZM`M`MdMdMfhnpv  yB  C  C  	CrU   c                 j    | j                  ||||      }|D ]  }|| j                  ||||      z  } |S r  )r!  r-  )rz   r   r   r  r  r  r  rX  s           rV   r)  z(FolderAdmin._copy_files_and_folders_implp  sK    ^[&)L! 	FA""1k69EEA	F rU   c                    | j                   j                  }|j                  }| j                  |||      }| j	                  |||      }| j                  |||      }| j                  |||d      }	|j                  dk(  r|j                  j                  d      r|rt        t        |j                        }
|
j                         r	 | j                  |      j                  |j                  j                  d            }t        |	      }||vs||   d   st        |j!                         |j!                         z   rC| j#                  ||||
j$                  d   d      }| j'                  |t)        d      ||d	z         y t               }
	 t+        |j                  j                  dd
            }| j0                  j3                  |      }|j5                  t)        d      |t)        d      ||	||
||||t7        d      |t8        j:                  d       t=        |d|      S # | j                   j                  $ r t        w xY w# t,        $ r |r|j.                  }nd
}Y w xY w)NFr~   r  r  ro   r9   r  zOSuccessfully copied %(count)d files and/or folders to folder '%(destination)s'.r  r   zCopy files and/or foldersr  )r   rt   r  to_copyr  selected_destination_folder	copy_formr   r   r  r  r  r   r  z/admin/filer/folder/choose_copy_destination.html)rR   r   r   r  r  r  r  r0  r~   r}   r   r;   r  rr   r   r  r9  r)  rq   r6  r   r}  r  rp   r   r;  r   r   r
   r4  r   )rz   ry   r   r   r  r   r  r  r0  r  r   r  r  r  r1  r   s                   rV   rc   z"FolderAdmin.copy_files_and_foldersx  sz   zzNN	88.Rbc--g~GWX00.JZ[44W>NP^`ef>>V#(8(8(@&&*7<<8D}}+"&"3"3G"<"@"@GLLDTDTUbDc"@"dK  $G}l2,{:STU:V**!''),<,B,B,DD99.JZ\gimiziz  |D  jE  GL  MA%%gq  2C  0D!"'2G 0  *,D	0*-gll.>.>}a.P*Q' //..w723&"#$?"@#*+F, 0) /"$+$@$@
 	$  )Z\cddW zz.. +**+$  	0.<.?.?+./+		0s   	:H& %I	 & I	I&%I&z"Copy selected files and/or foldersc                 l    	 t        ||       t        ||       t        ||       y# t        $ r Y yw xY wr  )rC   rE   rB   r   r  s       rV   _check_resize_permszFolderAdmin._check_resize_perms  s?    	(.A)'3CD(.A    		s   $' 	33c              #     K   |D ]  }t        | j                  ||j                  j                                     }|j	                  t        |j                        D cg c]C  }t        |t              s| j                  ||j                  | j                  t                     E c}       |s| j                  ||j                  | j                  t                      |  y c c}w wr  )r  _list_folders_to_resizer   r   r  r  r$  rs  Imager  r   r   r  r  s         rV   r6  z#FolderAdmin._list_folders_to_resize  s      	BD88"++//BSTUHOOeklnltlteu  O`a  zD  EF  HM  zNT221gllDOOUXUZ[  O  P++BdoosuUU	 Os   AC-C(
32C(
%	C-/>C-c                    t        | j                  ||            }|j                  t        |      D cg c]C  }t	        |t
              s| j                  ||j                  | j                  t                     E c}       |S c c}w r  )
r  r6  r  r  rs  r7  r  r   r   r  )rz   ry   r   r   	to_resizerX  s         rV   _list_all_to_resizezFolderAdmin._list_all_to_resize  s    55g?OPQ	bhiwbx  R]^  }G  HI  KP  }Q$//7<<RURWX  R  	S Rs   B
2Bc                     |rt        |dz        t        |dz        fS t        ||z  ||z        }t        ||z        t        ||z        fS )Nr'   )r}  min)	rz   original_widthoriginal_height	new_width
new_heightr   ycropscales	            rV   _new_subject_locationz!FolderAdmin._new_subject_location  sW     y1}%s:>'::: 	N2J4PQEuqy>3uqy>11rU   c           
         t        |j                        }t        |j                        }t        |j                  |j                  j
                  |j                  j                  |j                  j                        }|j                  t        fddD              d   d   |j                  d      }|j                  |j                  _        |j                          |j                          t        |j                        }|r|\  }}	t        |      }t        |	      }	t        |j                        }
t        |j                        }| j                  |||
|||	d         \  }}d||fz  |_	        |j                          y y )N)r   rN   source_storagethumbnail_storagec              3   B   K   | ]  }t        |   xs d         yw)r   N)r}  ).0dr	  s     rV   	<genexpr>z,FolderAdmin._resize_image.<locals>.<genexpr>  s     NQ#il/a0Ns   )widthheightrB  r   )rJ  rB  r   subject_locationz%d,%d)floatrL  rM  r7   r   rN   rF  get_thumbnailtuplerN  file_data_changedr   r5   rD  )rz   imager	  r=  r>  thumbnailer	new_imagerN  r   rA  r?  r@  new_xnew_ys     `           rV   _resize_imagezFolderAdmin._resize_image  sq   u{{+-,%**5::??chcmcmc|c|  QV  Q[  Q[  Qj  Qj  k--N:MNNf% + % 6 6	/
 	 $..

 	!

5e6L6LM%FQaAaAekk*Iu||,J!77Ybdnpqstv  AG  wH  INUE%,u~%=E"JJL rU   c                 h    d}|D ]*  }t        |t              s| j                  ||       |dz  }, |S r  )rs  r7  rX  )rz   r$  r	  r  rX  s        rV   _resize_imageszFolderAdmin._resize_images  s@     	A!U#""1i0Q	 rU   c                     | j                  |j                  j                         |j                  j                         |      S r  )_resize_images_implr$  r   r   )rz   rY   r	  s      rV   _resize_folderzFolderAdmin._resize_folder  s2    ''(8(8(:FOO<O<O<QS\]]rU   c                 b    | j                  ||      }|D ]  }|| j                  ||      z  } |S r  )rZ  r]  )rz   r   r   r	  r  rX  s         rV   r\  zFolderAdmin._resize_images_impl  sA    	:! 	3A$$Q	22A	3 rU   c                    | j                   j                  }|j                  }| j                  |||      }| j	                  |||      }| j                  |||      }|j                  dk(  r\|j                  j                  d      r@|rt        t        |j                        }	|	j                         r|	j                  j                  d      r|	j                  d   j                  |	j                  d<   |	j                  d   j                  |	j                  d<   |	j                  d   j                  |	j                  d<   |	j                  d   j                   |	j                  d<   |j#                         |j#                         z   r=| j%                  |||	j                        }
| j'                  |t)        d      d	|
iz         y t               }	| j*                  j-                  |      }|j/                  t)        d
      |t)        d
      ||	||||t1        d      |t2        j4                  d       t7        |d|      S )Nr~   r  thumbnail_optionrL  rM  rB  r   z&Successfully resized %(count)d images.r9  zResize imagesr  )r   rt   r  r9  resize_formr   r   r  r  r  r   r  z4admin/filer/folder/choose_images_resize_options.html)rR   r   r   r  r4  r:  r0  r~   r}   r   r=   r  rq   rL  rM  rB  r   r9  r\  r6  r   r   r;  r   r   r
   r4  r   )rz   ry   r   r   r  r   r  r  r9  r   r  r   s               rV   rd   zFolderAdmin.resize_images	  s   zzNN	88.Rbc//IYZ,,WnFVW	>>V#(8(8(@&&#GLL1D}}$$(();<151B1BCU1V1\1\D%%g.262C2CDV2W2^2^D%%h/040A0ABT0U0Z0ZD%%f-373D3DEW3X3`3`D%%i0!''),<,B,B,DD00AQSWSdSdeA%%gq1Y/Z^egh]k/kl#%D//..w7'&"#O"4", 0) /"$+$@$@
 	   )_ahiirU   zResize selected imagesr  )FFr   N)NN)rT   )ErO   rP   rQ   r  ru   list_per_pagelist_filterrd  autocomplete_fieldssave_asrL  r  rG  r(  r   r   r   r   r   r   
allow_tagsr   r   r!  r#  propertyrv  re  r5  r  r  r   short_descriptionr  r  r  ra   r  r  r  r  r  r  r  r  r  rb   r
  r  r  r  re   r  r  r!  r&  r-  r)  rc   r4  r6  r:  rD  rX  rZ  r]  r\  rd   __classcell__)r   s   @rV   r[   r[   ?   s   LGMKHM")GJG %P"%M":>"50 FK,0
7,
\rH!HuSn* 
 

M^&P +,,N*O'*XB +,,S*T'B *++S)T&o
b 122X0Y-F&
YJ42eh 011U/V,(m'bR &'~%6L"-&
C4;ez 011U/V,
28^+jZ '((@&AM##rU   r[   )mr.  r  r&  collectionsr   urllib.parser   rA  r   r  djangor   r  r   django.confr   r   django.contribr	   django.contrib.adminr
   django.contrib.admin.utilsr   django.core.exceptionsr   r   django.core.paginatorr   r   r   	django.dbr   r   django.db.modelsr   r   r   r   r   django.db.models.functionsr   r   django.httpr   r   django.shortcutsr   django.template.responser   django.urlsr   r   django.utils.encodingr    django.utils.htmlr!   r"   django.utils.safestringr#   django.utils.translationr$   r   r%   easy_thumbnails.modelsr&   r   cacher(   r)   r*   r+   r,   r-   r.   r/   r0   r1   r2   r3   r4   thumbnail_processorsr5   utils.compatibilityr6   utils.filer_easy_thumbnailsr7   utils.loaderr8   r:   r;   r<   r=   patched.admin_utilsr>   r   r?   r@   rA   rB   rC   rD   rE   rF   rG   rH   r7  	ModelFormrJ   r[   rT   rU   rV   <module>r     s     	 	 # * . ,  3 # ( ? ? D H H $ > > 6 : . 5 % + 1 - 6 2 ,  1 m m m  > 7 @ %  M M 4 ;   	$% wB4 wBrU   