app/projrev/views/base.py
author Madhusudan.C.S <madhusudancs@gmail.com>
Mon, 10 Aug 2009 03:24:02 +0530
changeset 30 94fe7fe7394d
parent 12 aac4944aca52
permissions -rw-r--r--
Complete star plugin implmentation on backend with database writes.
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
12
aac4944aca52 With ACL registers
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 4
diff changeset
    12
from django.shortcuts import render_to_response
aac4944aca52 With ACL registers
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 4
diff changeset
    13
from django.template import RequestContext
3
252a2d9713a5 Fixing the previous patch. Adding app.projrev.views.base
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    14
252a2d9713a5 Fixing the previous patch. Adding app.projrev.views.base
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    15
252a2d9713a5 Fixing the previous patch. Adding app.projrev.views.base
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    16
def home(request):
252a2d9713a5 Fixing the previous patch. Adding app.projrev.views.base
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    17
  """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
    18
  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
    19
  """
252a2d9713a5 Fixing the previous patch. Adding app.projrev.views.base
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    20
252a2d9713a5 Fixing the previous patch. Adding app.projrev.views.base
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    21
  if request.user.is_authenticated():
252a2d9713a5 Fixing the previous patch. Adding app.projrev.views.base
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    22
    if request.user.is_staff:
4
8d9da911ed7d Withdraw of proposals.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 3
diff changeset
    23
      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
    24
    else:
4
8d9da911ed7d Withdraw of proposals.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 3
diff changeset
    25
      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
    26
  else:
12
aac4944aca52 With ACL registers
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 4
diff changeset
    27
    template = 'projrev/home.html'
aac4944aca52 With ACL registers
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 4
diff changeset
    28
    return render_to_response(template, RequestContext(request, {}))