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