ó
ų¢TQc           @   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 m Z d	   Z e d
  e _ d S(   s-   
Built-in, globally-available admin actions.
i’’’’(   t   PermissionDenied(   t   helpers(   t   get_deleted_objectst   model_ngettext(   t   router(   t   TemplateResponse(   t
   force_text(   t   ugettext_lazyt   ugettextc         C   s  |  j  j } | j } |  j |  s- t  n  t j |  j   } t | | | j |  j	 |  \ } } } | j
 j d  r| r t  n  | j   }	 |	 r
x- | D]% }
 t |
  } |  j | |
 |  q  W| j   |  j | t d  i |	 d 6t |  j |	  d 6 n  d St |  d k r2t | j  } n t | j  } | sM| rgt d  i | d 6} n t d  } i	 | d	 6| d
 6| g d 6| d 6| d 6| d 6| d 6| d 6t j d 6} t | |  j pšd | | j j   f d | d g | d |  j	 j S(   s\  
    Default action which deletes the selected objects.

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

    Next, it delets 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   querysett   perms_lackingt	   protectedt   optst	   app_labelt   action_checkbox_names-   admin/%s/%s/delete_selected_confirmation.htmls*   admin/%s/delete_selected_confirmation.htmls'   admin/delete_selected_confirmation.htmlt   current_appN(   t   modelt   _metaR   t   has_delete_permissionR    R   t   db_for_writeR   t   usert
   admin_sitet   POSTt   getR
   R   t   log_deletiont   deletet   message_usert   _R   R   t   Nonet   lent   verbose_namet   verbose_name_pluralR   t   ACTION_CHECKBOX_NAMER   t%   delete_selected_confirmation_templatet   object_namet   lowerR   (   t
   modeladmint   requestR   R   R   t   usingR   t   perms_neededR   t   nt   objt   obj_displayR   R   t   context(    (    s5   ../Django//lib/python/django/contrib/admin/actions.pyt   delete_selected   sP    
		$	
"
s'   Delete selected %(verbose_name_plural)sN(   t   __doc__t   django.core.exceptionsR    t   django.contrib.adminR   t   django.contrib.admin.utilR   R   t	   django.dbR   t   django.template.responseR   t   django.utils.encodingR   t   django.utils.translationR   R   R"   R3   t   short_description(    (    (    s5   ../Django//lib/python/django/contrib/admin/actions.pyt   <module>   s   	F