sdi/views.py
author nishanth
Sat, 29 May 2010 18:41:04 +0530
changeset 24 f79be1dd4a22
parent 23 2aae8293f3a7
child 25 30baf3c635c5
permissions -rw-r--r--
added clean methods for each attribute in search form

from django.shortcuts import render_to_response, redirect

from sage_days.sdi.models import Registrant
from sage_days.sdi.forms import RegisterForm, SearchForm

def register(request):
    """ The user register page.
    """

    if request.method == "POST":
        form = RegisterForm(request.POST)
        if form.is_valid():
            form.save()
            return redirect("/registration/complete")
        else:
            return render_to_response("register.html", {"form":form})
    else:
        form = RegisterForm()
        return render_to_response("register.html", {"form":form})

def reg_complete(request):
    """ Tell the registration is successful.
    """

    return render_to_response("reg_complete.html")

def list_stats(request):
    """ List the statiscs of registered participants.
    """

    if request.method == "POST":
        form = SearchForm(request.POST)
        if form.is_valid():
            pass
        else:
            return render_to_response("list_stats.html", {"form":form})
    else:
        form = SearchForm()
        return render_to_response("list_stats.html", {"form":form})