ó
­â0_c           @   sŪ   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 d d	 l m Z m Z d
   Z e d  e _ d S(   s-   
Built-in, globally-available admin actions.
iĸĸĸĸ(   t   messages(   t   helpers(   t   get_deleted_objectst   model_ngettext(   t   PermissionDenied(   t   router(   t   TemplateResponse(   t
   force_text(   t   ugettextt   ugettext_lazyc         C   s.  |  j  j } | j } |  j |  s- t  n  t j |  j   } t | | | j |  j	 |  \ } } } }	 | j
 j d  r|	 r| r t  n  | j   }
 |
 rx- | D]% } t |  } |  j | | |  qŠ W| j   |  j | t d  i |
 d 6t |  j |
  d 6t j  n  d St |  d k rBt | j  } n t | j  } | s]|	 rwt d  i | d 6} n t d  } t |  j	 j |  d	 | d
 | d | g d t |  j   d | d | d |	 d | d t j d |  j 
} |  j	 j  | _! t" | |  j# p'd | | j$ f d | d g |  S(   s[  
    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.
    t   posts)   Successfully deleted %(count)d %(items)s.t   countt   itemsi   s   Cannot delete %(name)st   names   Are you sure?t   titlet   objects_namet   deletable_objectst   model_countt   querysett   perms_lackingt	   protectedt   optst   action_checkbox_namet   medias-   admin/%s/%s/delete_selected_confirmation.htmls*   admin/%s/delete_selected_confirmation.htmls'   admin/delete_selected_confirmation.htmlN(%   t   modelt   _metat	   app_labelt   has_delete_permissionR   R   t   db_for_writeR   t   usert
   admin_sitet   POSTt   getR   R   t   log_deletiont   deletet   message_usert   _R   R   R    t   SUCCESSt   Nonet   lent   verbose_namet   verbose_name_pluralt   dictt   each_contextR   R   t   ACTION_CHECKBOX_NAMER   R   t   current_appR   t%   delete_selected_confirmation_templatet
   model_name(   t
   modeladmint   requestR   R   R   t   usingR   R   t   perms_neededR   t   nt   objt   obj_displayR   R   t   context(    (    s>   /tmp/pip-unpacked-wheel-BAJOf3/django/contrib/admin/actions.pyt   delete_selected   sX    
		'	
		s'   Delete selected %(verbose_name_plural)sN(   t   __doc__t   django.contribR    t   django.contrib.adminR   t   django.contrib.admin.utilsR   R   t   django.core.exceptionsR   t	   django.dbR   t   django.template.responseR   t   django.utils.encodingR   t   django.utils.translationR   R$   R	   R8   t   short_description(    (    (    s>   /tmp/pip-unpacked-wheel-BAJOf3/django/contrib/admin/actions.pyt   <module>   s   	K