profile/views.py
author Nishanth Amuluru <nishanth@fossee.in>
Fri, 07 Jan 2011 11:27:29 +0530
changeset 268 f501fc2a9f4c
parent 267 b1245d75938d
child 269 dde894b36370
permissions -rwxr-xr-x
modified the redirect url
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
266
4dfcc826b241 Created a view for viewing profile
Nishanth Amuluru <nishanth@fossee.in>
parents: 241
diff changeset
     1
from django.shortcuts import render_to_response, redirect
4dfcc826b241 Created a view for viewing profile
Nishanth Amuluru <nishanth@fossee.in>
parents: 241
diff changeset
     2
4dfcc826b241 Created a view for viewing profile
Nishanth Amuluru <nishanth@fossee.in>
parents: 241
diff changeset
     3
from django.contrib.auth.decorators import login_required
4dfcc826b241 Created a view for viewing profile
Nishanth Amuluru <nishanth@fossee.in>
parents: 241
diff changeset
     4
4dfcc826b241 Created a view for viewing profile
Nishanth Amuluru <nishanth@fossee.in>
parents: 241
diff changeset
     5
@login_required
4dfcc826b241 Created a view for viewing profile
Nishanth Amuluru <nishanth@fossee.in>
parents: 241
diff changeset
     6
def view_profile(request):
4dfcc826b241 Created a view for viewing profile
Nishanth Amuluru <nishanth@fossee.in>
parents: 241
diff changeset
     7
4dfcc826b241 Created a view for viewing profile
Nishanth Amuluru <nishanth@fossee.in>
parents: 241
diff changeset
     8
    user = request.user
4dfcc826b241 Created a view for viewing profile
Nishanth Amuluru <nishanth@fossee.in>
parents: 241
diff changeset
     9
4dfcc826b241 Created a view for viewing profile
Nishanth Amuluru <nishanth@fossee.in>
parents: 241
diff changeset
    10
    profile = user.get_profile()
4dfcc826b241 Created a view for viewing profile
Nishanth Amuluru <nishanth@fossee.in>
parents: 241
diff changeset
    11
4dfcc826b241 Created a view for viewing profile
Nishanth Amuluru <nishanth@fossee.in>
parents: 241
diff changeset
    12
    context = {"user": user,
4dfcc826b241 Created a view for viewing profile
Nishanth Amuluru <nishanth@fossee.in>
parents: 241
diff changeset
    13
               "profile": profile,
4dfcc826b241 Created a view for viewing profile
Nishanth Amuluru <nishanth@fossee.in>
parents: 241
diff changeset
    14
              }
267
b1245d75938d Added template for viewing profile
Nishanth Amuluru <nishanth@fossee.in>
parents: 266
diff changeset
    15
    return render_to_response("profile/view.html", context)