def member_profile_view(request, targetUsername):
    ''' View a member's Profile. '''
    if targetUsername == request.user.username and targetUsername != ANONYMOUS_USERNAME:
        return HttpResponseRedirect(reverse('my_profile'))
    page_name = "{0}'s Profile".format(targetUsername)
    targetUser = get_object_or_404(User, username=targetUsername)
    targetProfile = get_object_or_404(UserProfile, user=targetUser)
    number_of_threads = Thread.objects.filter(owner=targetProfile).count()
    number_of_messages = Message.objects.filter(owner=targetProfile).count()
    number_of_requests = Request.objects.filter(owner=targetProfile).count()
    rooms = Room.objects.filter(current_residents=targetProfile)
    prev_rooms = PreviousResident.objects.filter(resident=targetProfile)
    return render_to_response('member_profile.html', {
        'page_name': page_name,
        'targetUser': targetUser,
        'targetProfile': targetProfile,
        'number_of_threads': number_of_threads,
        'number_of_messages': number_of_messages,
        'number_of_requests': number_of_requests,
        "rooms": rooms,
        "prev_rooms": prev_rooms,
        }, context_instance=RequestContext(request))
def member_profile_view ( request , targetUsername ) : if targetUsername == request . user . username and targetUsername != ANONYMOUS_USERNAME : return HttpResponseRedirect ( reverse ( 'my_profile' ) ) page_name = "{0}'s Profile" . format ( targetUsername ) targetUser = get_object_or_404 ( User , username = targetUsername ) targetProfile = get_object_or_404 ( UserProfile , user = targetUser ) number_of_threads = Thread . objects . filter ( owner = targetProfile ) . count ( ) number_of_messages = Message . objects . filter ( owner = targetProfile ) . count ( ) number_of_requests = Request . objects . filter ( owner = targetProfile ) . count ( ) rooms = Room . objects . filter ( current_residents = targetProfile ) prev_rooms = PreviousResident . objects . filter ( resident = targetProfile ) return render_to_response ( 'member_profile.html' , { 'page_name' : page_name , 'targetUser' : targetUser , 'targetProfile' : targetProfile , 'number_of_threads' : number_of_threads , 'number_of_messages' : number_of_messages , 'number_of_requests' : number_of_requests , "rooms" : rooms , "prev_rooms" : prev_rooms , } , context_instance = RequestContext ( request ) )
View a member's Profile.