sdi/views.py
branchanoop
changeset 56 7dfacad8adee
parent 53 b226923fbf64
child 57 03150449a049
equal deleted inserted replaced
55:1091f42e4a41 56:7dfacad8adee
     1 from django.shortcuts import render_to_response, redirect
     1 from django.shortcuts import render_to_response, redirect
     2 from django.http import HttpResponse
     2 from django.http import HttpResponse
     3 
     3 
     4 
     4 
     5 from sage_days.sdi.models import Registrant
     5 from sage_days.sdi.models import Registrant
     6 from sage_days.sdi.forms import RegisterForm, SearchForm
     6 from sage_days.sdi.forms import RegisterForm, SearchForm, EmailForm
     7 from sage_days.sdi.events import send_reg_complete_mail
     7 from sage_days.sdi.events import send_reg_complete_mail, mail_invi
     8 
     8 
     9 def register(request):
     9 def register(request):
    10     """ The user register page.
    10     """ The user register page.
    11     """
    11     """
    12 
    12 
    79             return render_to_response("list_stats.html", {"form":form})
    79             return render_to_response("list_stats.html", {"form":form})
    80     else:
    80     else:
    81         form = SearchForm()
    81         form = SearchForm()
    82         return render_to_response("list_stats.html", {"form":form})
    82         return render_to_response("list_stats.html", {"form":form})
    83 
    83 
       
    84 def send_invi(request):
       
    85     """ Take a list of csv email addresses and send mails to them.
       
    86     """
       
    87 
       
    88     if request.method == "POST":
       
    89         form = EmailForm(request.POST)
       
    90         if form.is_valid():
       
    91             to_emails = form.cleaned_data['emails']
       
    92             mail_invi(to_emails)
       
    93             return render_to_response("send_invi.html", {"emails":to_emails})
       
    94         else:
       
    95             return render_to_response("send_invi.html", {"form":form})
       
    96     else:
       
    97         return render_to_response("send_invi.html", {"form":form})
       
    98 
       
    99 
       
   100 
    84 def homepage(request):
   101 def homepage(request):
    85         return render_to_response("index.html")
   102         return render_to_response("index.html")
    86 
   103 
    87 def schedule(request):
   104 def schedule(request):
    88 	return render_to_response("schedule.html")
   105 	return render_to_response("schedule.html")