B
    ¢0H[‡  ã               @   sv   d Z ddlmZ ddlmZ ddlmZmZ ddlm	Z	 ddl
mZ ddlmZ ddlmZmZ d	d
„ Zedƒe_dS )z-
Built-in, globally-available admin actions.
é    )Úmessages)Úhelpers)Úget_deleted_objectsÚmodel_ngettext)ÚPermissionDenied)Úrouter)ÚTemplateResponse)ÚgettextÚgettext_lazyc             C   sR  | j j}|j}|  |¡st‚t | j ¡}t|||j| j	|ƒ\}}}}	|j
 d¡r¾|	s¾|r\t‚| ¡ }
|
rºx"|D ]}t|ƒ}|  |||¡ qnW | ¡  |  |tdƒ|
t| j|
ƒdœ tj¡ dS t|ƒ}|sÎ|	ràtdƒd|i }ntdƒ}t| j	 |¡|t|ƒ|gt|ƒ ¡ |||	|tj| jd�}| j	j|_t|| j�pLd	||j f d
| dg|ƒS )a[  
    Default action which deletes the selected objects.

    This action first displays a confirmation page which shows all the
    deletable objects, or, if the user has no permission one of the related
    childs (foreignkeys), a "permission denied" message.

    Next, it deletes all selected objects and redirects back to the change list.
    Úpostz)Successfully deleted %(count)d %(items)s.)ÚcountÚitemsNzCannot delete %(name)sÚnamezAre you sure?)
ÚtitleÚobjects_nameÚdeletable_objectsÚmodel_countÚquerysetZperms_lackingÚ	protectedÚoptsZaction_checkbox_nameÚmediaz-admin/%s/%s/delete_selected_confirmation.htmlz*admin/%s/delete_selected_confirmation.htmlz'admin/delete_selected_confirmation.html)!ÚmodelZ_metaÚ	app_labelZhas_delete_permissionr   r   Zdb_for_writer   ÚuserZ
admin_siteÚPOSTÚgetr   ÚstrZlog_deletionÚdeleteZmessage_userÚ_r   r   r   ÚSUCCESSÚdictZeach_contextr   r   ZACTION_CHECKBOX_NAMEr   r   Zcurrent_appr   Z%delete_selected_confirmation_templateZ
model_name)Z
modeladminÚrequestr   r   r   Zusingr   r   Zperms_neededr   ÚnÚobjZobj_displayr   r   Úcontext© r%   ú`C:\Users\HIRONO~1\AppData\Local\Temp\pip-install-6bm3nxem\django\django\contrib\admin\actions.pyÚdelete_selected   sT    






r'   z'Delete selected %(verbose_name_plural)sN)Ú__doc__Zdjango.contribr   Zdjango.contrib.adminr   Zdjango.contrib.admin.utilsr   r   Zdjango.core.exceptionsr   Z	django.dbr   Zdjango.template.responser   Zdjango.utils.translationr	   r   r
   r'   Zshort_descriptionr%   r%   r%   r&   Ú<module>   s   H