Permalink
Browse files

Create page listing users

  • Loading branch information...
1 parent 8ac451d commit a143ee21d0c0647c38c31abe66dca5f1ef236500 Jaime Irurzun committed Apr 29, 2012
View
@@ -15,5 +15,6 @@
url(r'^admin/', include(admin.site.urls)),
url(r'^tweet/(\d+)/$', 'website.views.tweet_page', name='tweet-page'),
url(r'^user/(\w+)/$', 'website.views.user_page', name='user-page'),
+ url(r'^users/$', 'website.views.users_list', name='users-list'),
url(r'^$', 'website.views.timeline', name='timeline'),
)
@@ -62,6 +62,7 @@
<div class="nav-collapse">
<ul class="nav">
<li><a href="{% url timeline %}">Timeline</a></li>
+ <li><a href="{% url users-list %}">Find users</a></li>
</ul>
</div>
</div>
@@ -0,0 +1,15 @@
+{% extends "website/base.html" %}
+
+{% block content %}
+
+<h2>dwitter users</h2>
+<ul>
+ {% for user in users %}
+ <li><a href="{% url user-page user.username %}">@{{ user.username }}</a><br />
+ {{ user.profile.bio }}
+ </li>
+ {% empty %}
+ No users.
+ {% endfor %}
+</ul>
+{% endblock %}
View
@@ -29,3 +29,8 @@ def tweet_page(request, tweet_id):
def user_page(request, username):
user = get_object_or_404(User, username=username)
return render(request, 'website/user_page.html', {'user': user})
+
+
+def users_list(request):
+ users = User.objects.all()
+ return render(request, 'website/users_list.html', {'users': users})

0 comments on commit a143ee2

Please sign in to comment.