app/projrev/views/base.py
author Madhusudan.C.S <madhusudancs@gmail.com>
Sun, 09 Aug 2009 23:24:48 +0530
changeset 23 91cf6872d853
parent 12 aac4944aca52
permissions -rw-r--r--
Add jqeury purr plugin for help text.

"""This module contains the views for the login for the portal.
"""


__authors__ = [
  '"Madhusudan.C.S" <madhusudancs@gmail.com>',
]


from django.core.urlresolvers import reverse
from django.http import HttpResponseRedirect
from django.shortcuts import render_to_response
from django.template import RequestContext


def home(request):
  """Redirect to the relevant page depending on the logged in user.
  Redirects to login page if the user is not logged in.
  """

  if request.user.is_authenticated():
    if request.user.is_staff:
      return HttpResponseRedirect(reverse('app.projrev.views.proposal.review'))
    else:
      return HttpResponseRedirect(reverse('app.projrev.views.proposal.submit'))
  else:
    template = 'projrev/home.html'
    return render_to_response(template, RequestContext(request, {}))