Fixing the previous patch. Adding app.projrev.views.base
authorMadhusudan.C.S <madhusudancs@gmail.com>
Thu, 06 Aug 2009 12:17:29 +0530
changeset 3 252a2d9713a5
parent 2 023ed68d5b5b
child 4 8d9da911ed7d
Fixing the previous patch. Adding app.projrev.views.base
app/projrev/views/base.py
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/app/projrev/views/base.py	Thu Aug 06 12:17:29 2009 +0530
@@ -0,0 +1,25 @@
+"""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
+
+
+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:
+      HttpResponseRedirect(reverse('app.projrev.views.proposal.review'))
+    else:
+      HttpResponseRedirect(reverse('app.projrev.views.proposal.submit'))
+  else:
+    HttpResponseRedirect(reverse('app.projrev.views.login.login_validate'))