sdi/views.py
branchanoop
changeset 53 b226923fbf64
parent 48 a3e6f9470549
child 56 7dfacad8adee
equal deleted inserted replaced
52:10840ccc564d 53:b226923fbf64
     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
       
     7 from sage_days.sdi.events import send_reg_complete_mail
     7 
     8 
     8 def register(request):
     9 def register(request):
     9     """ The user register page.
    10     """ The user register page.
    10     """
    11     """
    11 
    12 
    12     if request.method == "POST":
    13     if request.method == "POST":
    13         form = RegisterForm(request.POST)
    14         form = RegisterForm(request.POST)
    14         if form.is_valid():
    15         if form.is_valid():
    15             form.save()
    16             form.save()
       
    17 
       
    18             data = form.cleaned_data
       
    19             first_name = data['first_name']
       
    20             last_name = data['last_name']
       
    21             email = data['email']
       
    22             send_reg_complete_mail(email, first_name, last_name)
       
    23 
    16             return redirect("/sage_days/registration/complete")
    24             return redirect("/sage_days/registration/complete")
    17         else:
    25         else:
    18             return render_to_response("register.html", {"form":form})
    26             return render_to_response("register.html", {"form":form})
    19     else:
    27     else:
    20         form = RegisterForm()
    28         form = RegisterForm()