Hi guys, I want this code to display list of friends of a user, list of friends to add, after writing the codes and testing it out, I’m getting this error:
TypeError at /userpage/ user_page() takes exactly 2 arguments (1 given) Request Method: GET Request URL: http://127.0.0.1:8000/userpage/ Django Version: 1.3.1 Exception Type: TypeError Exception Value: user_page() takes exactly 2 arguments (1 given) Exception Location: C:\Python27\lib\site-packages\django\core\handlers \base.py in get_response, line 111 Python Executable: C:\Python27\python.exe Python Version: 2.7.2 Below are my codes: Views: def user_page(request, username): user=get_object_or_404(User, username=username) if request.user.is_authenticated(): is_friend=Friendship.objects.filter( from_friend=request.user, to_friend=user ) else: is_friend=False return render_to_response('user_page.html', context_instance=RequestContext(request)) Template: {% extends "base.html" %} {% block content %} {% ifequal user.username username %} <a href="/friends/{{ username }}/">view your friends</a> {% else %} {% if is_friend %} <a href="/friends/{{ user.username }}/"> {{ username }} is a friend of yours</a> {% else %} <a href="/friend/add/?username={{ username }}"> add {{ username }} to your friends</a> {% endif %} - <a href="/friends/{{ username }}/"> view {{username }}'s friends</a> {% endifequal %} {% endblock %} Please help me out! -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.