Ńň
ôQLc           @   sr   d  Z  d d k l Z d d k l Z d d k l Z d d k l Z d d k	 l
 Z
 e
 d d	 d	 e d  Z d	 S(
   s<   
View which can render and send email from a contact form.

i˙˙˙˙(   t   reverse(   t   HttpResponseRedirect(   t   render_to_response(   t   RequestContext(   t   ContactForms   contact_form/contact_form.htmlc   
      C   s  | d	 j o t d  } n |  i d j oM | d |  i d |  i d |   } | i   o | i d |  t |  Sn | d |   } | d	 j o
 h  } n t |   } x; | i	   D]- \ } }	 t
 |	  o
 |	   p |	 | | <qš Wt | h | d 6d | S(
   sF  
    Render a contact form, validate its input and send an email
    from it.

    **Optional arguments:**

    ``extra_context``
        A dictionary of variables to add to the template context. Any
        callable object in this dictionary will be called to produce
        the end result which appears in the context.

    ``fail_silently``
        If ``True``, errors when sending the email will be silently
        supressed (i.e., with no logging or reporting of any such
        errors. Default value is ``False``.

    ``form_class``
        The form to use. If not supplied, this will default to
        ``contact_form.forms.ContactForm``. If supplied, the form
        class must implement a method named ``save()`` which sends the
        email from the form; the form class must accept an
        ``HttpRequest`` as the keyword argument ``request`` to its
        constructor, and it must implement a method named ``save()``
        which sends the email and which accepts the keyword argument
        ``fail_silently``.

    ``success_url``
        The URL to redirect to after a successful submission. If not
        supplied, this will default to the URL pointed to by the named
        URL pattern ``contact_form_sent``.

    ``template_name``
        The template to use for rendering the contact form. If not
        supplied, defaults to
        :template:`contact_form/contact_form.html`.

    **Context:**

    ``form``
        The form instance.
    
    **Template:**

    The value of the ``template_name`` keyword argument, or
    :template:`contact_form/contact_form.html`.

    t   contact_form_sentt   POSTt   datat   filest   requestt   fail_silentlyt   formt   context_instanceN(   t   NoneR    t   methodR   t   FILESt   is_validt   saveR   R   t   itemst   callableR   (
   R	   t
   form_classt   template_namet   success_urlt   extra_contextR
   R   t   contextt   keyt   value(    (    s8   /var/www/Pootle/external_apps/contact_form_i18n/views.pyt   contact_form   s"    <!
 %N(   t   __doc__t   django.core.urlresolversR    t   django.httpR   t   django.shortcutsR   t   django.templateR   t   contact_form_i18n.formsR   R   t   FalseR   (    (    (    s8   /var/www/Pootle/external_apps/contact_form_i18n/views.pyt   <module>   s   