î
Þ^Q\#  ã               @   sL   d  Z  Gd d „  d e ƒ Z Gd d „  d e ƒ Z Gd d „  d e ƒ Z d S)z,Classes for class-based forward declaration.c               @   s4   e  Z d  Z d Z e d d „  ƒ Z d d „  Z d S)ÚForwardz0Base class for autocomplete forward declaration.c             C   s   t  d ƒ ‚ d S)z2Forward type. Should be implemented in subclasses.zPlease use one of my subclassesN)ÚNotImplementedError)Úself© r   ú@/var/www/dbchiro/venv/lib/python3.4/site-packages/dal/forward.pyÚtype   s    zForward.typec             C   s   i |  j  d 6S)z5Convert to dictionary which will be rendered as JSON.r   )r   )r   r   r   r   Úto_dict   s    zForward.to_dictN)Ú__name__Ú
__module__Ú__qualname__Ú__doc__Úpropertyr   r   r   r   r   r   r      s   r   c                   s=   e  Z d  Z d Z d Z d d d „ Z ‡  f d d †  Z ‡  S)ÚFieldaD  Forward field value.

    .. py:attribute:: src

        The name of the form field whose value will be forwarded to a view.

    .. py:attribute:: dst

        The name of the key of the forwarded value from the src field in the
        forwarded dictionary. If this value is ``None``, then the key is
        ``src``.
    ÚfieldNc             C   s   | |  _  | |  _ d S)z$Instantiate a forwarded field value.N)ÚsrcÚdst)r   r   r   r   r   r   Ú__init__#   s    	zField.__init__c                sQ   t  t |  ƒ j ƒ  } | j d |  j ƒ |  j d k	 rM | j d |  j ƒ n  | S)z5Convert to dictionary which will be rendered as JSON.r   Nr   )Úsuperr   r   Úupdater   r   )r   Úd)Ú	__class__r   r   r   (   s
    zField.to_dict)r   r	   r
   r   r   r   r   r   r   )r   r   r      s   r   c                   s:   e  Z d  Z d Z d Z d d „  Z ‡  f d d †  Z ‡  S)ÚConstzËForward arbitrary constant value.

    .. py:attribute:: val

        The value to forward. Must be JSON-serializable.

    .. py:attribute:: dst

        The name of the key of the forwarded value.
    Úconstc             C   s   | |  _  | |  _ d S)z'Instantiate a forwarded constant value.N)Úvalr   )r   r   r   r   r   r   r   A   s    	zConst.__init__c                s?   t  t |  ƒ j ƒ  } | j d |  j ƒ | j d |  j ƒ | S)z5Convert to dictionary which will be rendered as JSON.r   r   )r   r   r   r   r   r   )r   r   )r   r   r   r   F   s    zConst.to_dict)r   r	   r
   r   r   r   r   r   r   )r   r   r   3   s   
r   N)r   Úobjectr   r   r   r   r   r   r   Ú<module>   s    