sdi/views.py
branchanoop
changeset 26 212fcba4459e
parent 25 30baf3c635c5
child 31 ec540dfbfe78
equal deleted inserted replaced
25:30baf3c635c5 26:212fcba4459e
     1 from django.shortcuts import render_to_response, redirect
     1 from django.shortcuts import render_to_response, redirect
       
     2 from django.http import HttpResponse
       
     3 
     2 
     4 
     3 from sage_days.sdi.models import Registrant
     5 from sage_days.sdi.models import Registrant
     4 from sage_days.sdi.forms import RegisterForm, SearchForm
     6 from sage_days.sdi.forms import RegisterForm, SearchForm
     5 
     7 
     6 def register(request):
     8 def register(request):
     9 
    11 
    10     if request.method == "POST":
    12     if request.method == "POST":
    11         form = RegisterForm(request.POST)
    13         form = RegisterForm(request.POST)
    12         if form.is_valid():
    14         if form.is_valid():
    13             form.save()
    15             form.save()
    14             return redirect("/registration/complete")
    16             return redirect("/sage_days/registration/complete")
    15         else:
    17         else:
    16             return render_to_response("register.html", {"form":form})
    18             return render_to_response("register.html", {"form":form})
    17     else:
    19     else:
    18         form = RegisterForm()
    20         form = RegisterForm()
    19         return render_to_response("register.html", {"form":form})
    21         return render_to_response("register.html", {"form":form})
    68         else:
    70         else:
    69             return render_to_response("list_stats.html", {"form":form})
    71             return render_to_response("list_stats.html", {"form":form})
    70     else:
    72     else:
    71         form = SearchForm()
    73         form = SearchForm()
    72         return render_to_response("list_stats.html", {"form":form})
    74         return render_to_response("list_stats.html", {"form":form})
       
    75 
       
    76 def homepage(request):
       
    77         return render_to_response("index.html")
       
    78