î
ªÍ Xî  ã               @   sb   d  d l  Z  d  d l m Z m Z m Z d  d l m Z d  d l m Z Gd d „  d e ƒ Z	 d S)é    N)Úmail_adminsÚmail_managersÚ	send_mail)ÚBaseCommand)Útimezonec               @   s4   e  Z d  Z d Z d Z d d „  Z d d „  Z d S)ÚCommandzASends a test email to the email addresses specified as arguments.zRYou must specify some email recipients, or pass the --managers or --admin options.c          
   C   sg   | j  d d d d d ƒ| j  d d d d	 d
 d d d d ƒ| j  d d d d	 d d d d d ƒd  S)NÚemailÚnargsÚ*Úhelpz4One or more email addresses to send a test email to.z
--managersÚactionÚ
store_trueÚdestÚmanagersÚdefaultFzBSend a test email to the addresses specified in settings.MANAGERS.z--adminsÚadminsz@Send a test email to the addresses specified in settings.ADMINS.)Úadd_argument)ÚselfÚparser© r   ú[/home/ubuntu/projects/ifolica/build/django/django/core/management/commands/sendtestemail.pyÚadd_arguments   s    zCommand.add_argumentsc          
   O   sw   d t  j ƒ  t j ƒ  f } t d | d d d d  d | d ƒ | d rY t | d	 ƒ n  | d
 rs t | d ƒ n  d  S)NzTest email from %s on %sÚsubjectÚmessagez*If you're reading this, it was successful.Z
from_emailZrecipient_listr   r   z)This email was sent to the site managers.r   z'This email was sent to the site admins.)ÚsocketÚgethostnamer   Únowr   r   r   )r   ÚargsÚkwargsr   r   r   r   Úhandle   s    

zCommand.handleN)Ú__name__Ú
__module__Ú__qualname__r   Zmissing_args_messager   r   r   r   r   r   r      s   r   )
r   Zdjango.core.mailr   r   r   Zdjango.core.management.baser   Zdjango.utilsr   r   r   r   r   r   Ú<module>   s   