ó
¡ÆtWc           @   s“   d  d l  m Z d  d l m Z m Z m Z d  d l m Z d  d l Td  d l Td  d l	 Td e j
 f d „  ƒ  YZ d „  Z e j e d d	 ƒd
 S(   iÿÿÿÿ(   t   models(   t   datetimet   datet   time(   t   EncryptedCharField(   t   *t   Donationc        
   B   s¡  e  Z d d d d d  d! f Z e j d d e d e d	 d
 d e j ƒZ e j d d d e ƒ Z	 e j d d ƒ Z
 e j d d ƒ Z e j d d ƒ Z e j d d ƒ Z e j d d d e d e ƒ Z e j d d ƒ Z e j d d ƒ Z e j d d	 d ƒZ e d d ƒ Z e j d d d d ƒ Z e j d d ƒ Z e j d e d d e j ƒ Z e j d e ƒ Z e j d d ƒ Z e j d e ƒ Z  d „  Z! d „  Z" RS("   u   Mru   Mrsu   Missu   Msu   Doctoru	   Professors   members.Membert   blankt   nullt   related_namet   member_donationt	   on_deletet
   max_lengthi
   t   choicesiÈ   s   members.Countryt   donation_countrti   i(   t   verbose_names   Phone Numbers#   Amount you wish to donate (&pound;)t   defaultsÈ  <strong>Yes, I am a UK taxpayer and agree to the %s claiming tax on all past, present and future donations I make</strong><br/><br/> By ticking this box I confirm that I am paying or will pay and amount of Income Tax and/or Capital Gains Tax to cover the amount the society will reclaim (6th April one year to 5th April the next year). Council Tax and VAT do not qualify towards Gift Aid. The society will reclaim 25p on every &pound;1 that has been given.t   auto_now_addc         C   s   d |  j  |  j |  j f S(   Ns   %s %s %s(   t
   first_namet   surnamet   created(   t   self(    (    s6   /var/www/svtgbi.org/svtgbi/modules/donations/models.pyt   __unicode__*   s    c         C   s1   t  j j d |  d d ƒ } | r) | d St Sd  S(   Nt   donationt   statust   completei    (   t   Paymentt   objectst   filtert   False(   R   t   payments(    (    s6   /var/www/svtgbi.org/svtgbi/modules/donations/models.pyt   get_payment-   s    (   u   Mru   Mr(   u   Mrsu   Mrs(   u   Missu   Miss(   u   Msu   Ms(   u   Doctoru   Doctor(   u	   Professoru	   Professor(#   t   __name__t
   __module__t   TITLE_CHOICESR    t
   ForeignKeyt   Truet   SET_NULLt   membert	   CharFieldt   titleR   R   t
   EmailFieldt   email_addresst	   address_1t	   address_2t   townt   countyt   countryR   t   postcodet	   telephonet
   FloatFieldt   amountt   BooleanFieldR   t   settingst   WEBSITE_NAMEt   gift_aidt   DateTimeFieldR   t
   unique_keyR   R   R   (    (    (    s6   /var/www/svtgbi.org/svtgbi/modules/donations/models.pyR   
   s2   	*	c   	      K   sñ   | d } | d } y½ t  j j d d ƒ } | j r> d } n d } | j | j | j | j | j | t	 j
 t d d | j g ƒt	 j
 t d d | j g ƒf	 } | j } t | j | | | j j | j ƒ  ƒ Wn t k
 rì } | ‚ n Xd  S(	   Nt   requestR   t   keyt   donation_confirmation_admint   Yest   Not   admin_donations_view_donationt   args(   t   EmailTemplateR   t   getR7   t   contentR   R   R*   R3   R5   t   URLt   reverset   idt   subjectt	   send_mailR;   t   from_addresst   get_to_addressest	   Exception(	   t   sendert   kwargsR:   R   t   templateR7   RC   RG   t   e(    (    s6   /var/www/svtgbi.org/svtgbi/modules/donations/models.pyt#   donation_confirmation_email_handler4   s    

		^	)t   dispatch_uidt   donation_confirmation_emailN(   t	   django.dbR    R   R   R   t   modules.core.encryptionR   t   modules.notifications.modelst   modules.payments.modelst   signalst   ModelR   RP   RR   t   connect(    (    (    s6   /var/www/svtgbi.org/svtgbi/modules/donations/models.pyt   <module>   s   


*	