ó
O'^c           @   s*   d  d l  m Z d e f d     YZ d S(   i˙˙˙˙(   t   BaseCommandt   Commandc           B   s   e  Z e Z d  Z d   Z RS(   s<   Deactivate APNS devices that are not receiving notificationsc         O   s   d d l  m } m } |   } | j j d |  } x8 | D]0 } |  j j d | j  t | _	 | j
   q; W|  j j d t |   d  S(   Ni˙˙˙˙(   t
   APNSDevicet   get_expired_tokenst   registration_id__ins   deactivating [%s]s   deactivated %d devices(   t   push_notifications.modelsR   R   t   objectst   filtert   stdoutt   writet   registration_idt   Falset   activet   savet   len(   t   selft   argst   optionsR   R   t   expiredt   devicest   d(    (    sV   /tmp/pip-unpacked-wheel-MTFMX_/push_notifications/management/commands/prune_devices.pyt   handle   s    		(   t   __name__t
   __module__t   Truet   can_import_settingst   helpR   (    (    (    sV   /tmp/pip-unpacked-wheel-MTFMX_/push_notifications/management/commands/prune_devices.pyR      s   N(   t   django.core.management.baseR    R   (    (    (    sV   /tmp/pip-unpacked-wheel-MTFMX_/push_notifications/management/commands/prune_devices.pyt   <module>   s   