sdi/views.py
branchanoop
changeset 246 3a32df4b3171
parent 242 6826f27064c9
equal deleted inserted replaced
245:30053a24a92a 246:3a32df4b3171
     5 
     5 
     6 from django.contrib.auth import authenticate, login, logout
     6 from django.contrib.auth import authenticate, login, logout
     7 
     7 
     8 from sage_days.sdi.models import Registrant, RegistrantInfo, ParticipantInfo
     8 from sage_days.sdi.models import Registrant, RegistrantInfo, ParticipantInfo
     9 from sage_days.sdi.forms import RegisterForm, SearchForm, EmailForm, LoginForm, UserSelectForm, ParticipantInfoForm, SendAccoForm, EditAddressForm
     9 from sage_days.sdi.forms import RegisterForm, SearchForm, EmailForm, LoginForm, UserSelectForm, ParticipantInfoForm, SendAccoForm, EditAddressForm
    10 from sage_days.sdi.events import send_reg_complete_mail, mail_invi, send_sgd_ptc_confirm, send_cnf_email, send_wsp_ptc_confirm, send_acco_confirm_mail
    10 from sage_days.sdi.events import send_reg_complete_mail, mail_invi, mail_cust_invi, send_sgd_ptc_confirm, send_cnf_email, send_wsp_ptc_confirm, send_acco_confirm_mail
    11 from sage_days.settings import APACHE_URL_PREFIX as aup
    11 from sage_days.settings import APACHE_URL_PREFIX as aup
    12 
    12 
    13 def register(request):
    13 def register(request):
    14     """ The user register page.
    14     """ The user register page.
    15     """
    15     """
   112         else:
   112         else:
   113             return render_to_response("send_invi.html", {"form":form})
   113             return render_to_response("send_invi.html", {"form":form})
   114     else:
   114     else:
   115         form = EmailForm()
   115         form = EmailForm()
   116         return render_to_response("send_invi.html", {"form":form})
   116         return render_to_response("send_invi.html", {"form":form})
       
   117 
       
   118 @login_required
       
   119 def send_cust_invi(request):
       
   120     """ Take a list of csv email addresses and send mails to them.
       
   121     """
       
   122 
       
   123     if request.method == "POST":
       
   124         form = EmailForm(request.POST)
       
   125         if form.is_valid():
       
   126             to_emails = form.cleaned_data['emails']
       
   127             mail_cust_invi(to_emails)
       
   128             return render_to_response("send_cust_invi.html", {"emails":to_emails})
       
   129         else:
       
   130             return render_to_response("send_cust_invi.html", {"form":form})
       
   131     else:
       
   132         form = EmailForm()
       
   133         return render_to_response("send_cust_invi.html", {"form":form})
       
   134 
   117 
   135 
   118 @login_required
   136 @login_required
   119 def send_workshop_confirm(request):
   137 def send_workshop_confirm(request):
   120     """ Show a list of all the ppl who requested for a workshop and 
   138     """ Show a list of all the ppl who requested for a workshop and 
   121     send a confirmation mail to them if not sent.
   139     send a confirmation mail to them if not sent.