added browse users functionality, added user/browse.html, fixed view my profile template. default tip
authoranoop
Mon, 01 Feb 2010 17:30:30 +0530
changeset 22 943a35c14cf7
parent 21 3e676fa948c4
added browse users functionality, added user/browse.html, fixed view my profile template.
pytask/taskapp/views/user.py
pytask/templates/user/browse.html
pytask/templates/user/edit_profile.html
pytask/templates/user/my_profile.html
pytask/urls.py
--- a/pytask/taskapp/views/user.py	Mon Feb 01 16:52:34 2010 +0530
+++ b/pytask/taskapp/views/user.py	Mon Feb 01 17:30:30 2010 +0530
@@ -128,3 +128,7 @@
         profile = Profile.objects.get(user = request.user)
         edit_profile_form = UserProfileEditForm(instance = profile)
         return render_to_response('user/edit_profile.html',{'edit_profile_form' : edit_profile_form})
+
+def browse_users(request):
+    userlist = User.objects.order_by('username')
+    return render_to_response('user/browse.html',{'userlist':userlist})
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/pytask/templates/user/browse.html	Mon Feb 01 17:30:30 2010 +0530
@@ -0,0 +1,7 @@
+{% extends 'base.html' %}
+{% block content %}
+    List of all the users:<br />
+    {% for user in userlist %}
+        <a href="/user/view/uid={{ user.id }}">{{ user.username }}</a><br />
+    {% endfor %}
+{% endblock %}
--- a/pytask/templates/user/edit_profile.html	Mon Feb 01 16:52:34 2010 +0530
+++ b/pytask/templates/user/edit_profile.html	Mon Feb 01 17:30:30 2010 +0530
@@ -1,7 +1,7 @@
 {% extends 'base.html' %}
 {% block content %}
-<form action="/user/edit/" method="post">
-{{ edit_profile_form.as_p }}
-<input type="submit" value="Apply Changes" />
-</form>
+    <form action="/user/edit/" method="post">
+        {{ edit_profile_form.as_p }}
+    <input type="submit" value="Apply Changes" />
+    </form>
 {% endblock %}
--- a/pytask/templates/user/my_profile.html	Mon Feb 01 16:52:34 2010 +0530
+++ b/pytask/templates/user/my_profile.html	Mon Feb 01 17:30:30 2010 +0530
@@ -7,11 +7,12 @@
 {% block content %}
     <!--{{ view_profile_form.as_p }}-->
 
-    <h2>{{ profile }}'s Profile</h2><hr>
+    <h2>{{ profile }}'s Profile</h2>
+    <hr>
     {% if edit_profile %}
         <a href="/user/edit/">edit profile</a>
+        <hr>
     {% endif %}
-    <hr>
     {% if profile.aboutme %}
         <br><h4>About Me</h4><hr>{{ profile.aboutme }}
     {% endif %}
--- a/pytask/urls.py	Mon Feb 01 16:52:34 2010 +0530
+++ b/pytask/urls.py	Mon Feb 01 17:30:30 2010 +0530
@@ -4,7 +4,7 @@
 from django.contrib import admin
 admin.autodiscover()
 
-from pytask.taskapp.views.user import homepage, register, user_login, user_logout, view_my_profile, edit_my_profile
+from pytask.taskapp.views.user import homepage, register, user_login, user_logout, view_my_profile, edit_my_profile, browse_users
 from pytask.taskapp.views.task import browse_tasks, view_task, create_task, add_mentor, add_tasks, claim_task, assign_task
 
 urlpatterns = patterns('',
@@ -33,5 +33,5 @@
     
     (r'^user/view/uid=(\d+)$', view_my_profile),
     (r'^user/edit/?$', edit_my_profile),
-
+    (r'^user/browse/?$',browse_users),
 )