o
    tJc                     @   sB   d dl mZ d dlmZmZ d dlmZ dZG dd dejZ	dS )    )forms)base62DecodingError)LinkzNYour custom name is too long. Are you sure you wanted a shortening service? :)c                   @   s.   e Zd ZejddZejdddZdd ZdS )	LinkSubmitFormzURL to be shortened)labelzCustom shortened nameF)r   requiredc              
   C   s   | j d }|s	d S zt|}W n ty! } zt|d }~ww ztjj|d	 r3td| W d S  t
yA   ttw )Ncustom)idz"%s" is already taken)cleaned_datar   
to_decimalr   r   ValidationErrorr   objectsfilterexistsOverflowErrortoo_long_error)selfr	   r
   e r   7/var/www/html/docker_usevoice/src/apps/shorter/forms.pyclean_custom   s"   


zLinkSubmitForm.clean_customN)	__name__
__module____qualname__r   URLFieldurl	CharFieldr	   r   r   r   r   r   r   
   s    r   N)
djangor   apps.shorter.baseconvr   r   apps.shorter.modelsr   r   Formr   r   r   r   r   <module>   s
    