app/projrev/views/base.py
author Madhusudan.C.S <madhusudancs@gmail.com>
Thu, 06 Aug 2009 22:36:36 +0530
changeset 9 38727da8a948
parent 4 8d9da911ed7d
child 12 aac4944aca52
permissions -rw-r--r--
Create Account
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
3
252a2d9713a5 Fixing the previous patch. Adding app.projrev.views.base
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
     1
"""This module contains the views for the login for the portal.
252a2d9713a5 Fixing the previous patch. Adding app.projrev.views.base
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
     2
"""
252a2d9713a5 Fixing the previous patch. Adding app.projrev.views.base
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
     3
252a2d9713a5 Fixing the previous patch. Adding app.projrev.views.base
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
     4
252a2d9713a5 Fixing the previous patch. Adding app.projrev.views.base
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
     5
__authors__ = [
252a2d9713a5 Fixing the previous patch. Adding app.projrev.views.base
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
     6
  '"Madhusudan.C.S" <madhusudancs@gmail.com>',
252a2d9713a5 Fixing the previous patch. Adding app.projrev.views.base
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
     7
]
252a2d9713a5 Fixing the previous patch. Adding app.projrev.views.base
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
     8
252a2d9713a5 Fixing the previous patch. Adding app.projrev.views.base
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
     9
252a2d9713a5 Fixing the previous patch. Adding app.projrev.views.base
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    10
from django.core.urlresolvers import reverse
252a2d9713a5 Fixing the previous patch. Adding app.projrev.views.base
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    11
from django.http import HttpResponseRedirect
252a2d9713a5 Fixing the previous patch. Adding app.projrev.views.base
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    12
252a2d9713a5 Fixing the previous patch. Adding app.projrev.views.base
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    13
252a2d9713a5 Fixing the previous patch. Adding app.projrev.views.base
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    14
def home(request):
252a2d9713a5 Fixing the previous patch. Adding app.projrev.views.base
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    15
  """Redirect to the relevant page depending on the logged in user.
252a2d9713a5 Fixing the previous patch. Adding app.projrev.views.base
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    16
  Redirects to login page if the user is not logged in.
252a2d9713a5 Fixing the previous patch. Adding app.projrev.views.base
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    17
  """
252a2d9713a5 Fixing the previous patch. Adding app.projrev.views.base
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    18
252a2d9713a5 Fixing the previous patch. Adding app.projrev.views.base
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    19
  if request.user.is_authenticated():
252a2d9713a5 Fixing the previous patch. Adding app.projrev.views.base
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    20
    if request.user.is_staff:
4
8d9da911ed7d Withdraw of proposals.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 3
diff changeset
    21
      return HttpResponseRedirect(reverse('app.projrev.views.proposal.review'))
3
252a2d9713a5 Fixing the previous patch. Adding app.projrev.views.base
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    22
    else:
4
8d9da911ed7d Withdraw of proposals.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 3
diff changeset
    23
      return HttpResponseRedirect(reverse('app.projrev.views.proposal.submit'))
3
252a2d9713a5 Fixing the previous patch. Adding app.projrev.views.base
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    24
  else:
4
8d9da911ed7d Withdraw of proposals.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 3
diff changeset
    25
    return HttpResponseRedirect(reverse('app.projrev.views.login.login_validate'))