î
#dÝVµ  ã               @   sR   d  d l  Z  d  d l m Z m Z d  d l m Z d Z Gd d „  d e ƒ Z d S)é    N)ÚBaseCommandÚCommandError)Úrender_to_stringzdashboard.pyc               @   s1   e  Z d  Z d Z d Z d Z d d d „ Z d S)ÚCommandz_Creates a template file containing the base code to get you started with your custom dashboard.z[file]zapplication nameNc             K   sË   i  } t  j j t  j ƒ  ƒ | d <d d g } | d  k	 r@ | pC t } t  j j | ƒ rk t d | ƒ ‚ n  t  j j | ƒ j d ƒ d | d <t | d ƒ j	 t
 | | ƒ ƒ t d	 t  j j | ƒ ƒ d  S)
NÚprojectzdashboard/dashboard.txtz!grappelli/dashboard/dashboard.txtzfile "%s" already existsÚ.r   ÚfileÚwz"%s" written.)ÚosÚpathÚbasenameÚgetcwdÚDEFAULT_FILEÚexistsr   ÚsplitÚopenÚwriter   ÚprintÚjoin)Úselfr   ÚoptionsÚcontextÚtplÚdst© r   úc/tmp/pip-build-0jahl3lb/django-grappelli/grappelli/dashboard/management/commands/customdashboard.pyÚhandle   s    #zCommand.handle)Ú__name__Ú
__module__Ú__qualname__ÚhelpÚargsÚlabelr   r   r   r   r   r      s   r   )r
   Zdjango.core.management.baser   r   Zdjango.template.loaderr   r   r   r   r   r   r   Ú<module>   s   