diff gpp/bio/views.py @ 147:152d77265da6

Implement #38: add function to mark user as a spammer. Display only active members on member list. Display login form as table (not sure why wasn't doing this before).
author Brian Neal <bgneal@gmail.com>
date Sun, 13 Dec 2009 08:11:16 +0000
parents 7ea842744a57
children ab7830b067b3
line wrap: on
line diff
--- a/gpp/bio/views.py	Wed Dec 09 22:58:05 2009 +0000
+++ b/gpp/bio/views.py	Sun Dec 13 08:11:16 2009 +0000
@@ -30,12 +30,17 @@
 
 @login_required
 def member_list(request, type='user', page=1):
+    """
+    This view displays the member list. Only active members are displayed.
+    """
+    qs = auth.models.User.objects.filter(is_active=True)
     if type == 'user':
-        users = auth.models.User.objects.all().order_by('username')
+        qs = qs.order_by('username')
     else:
-        users = auth.models.User.objects.all().order_by('date_joined')
+        qs = qs.order_by('date_joined')
+    num_members = qs.count()
 
-    paginator = DiggPaginator(users, 10, body=5, tail=3, margin=3, padding=2)
+    paginator = DiggPaginator(qs, 20, body=5, tail=3, margin=3, padding=2)
     try:
         the_page = paginator.page(int(page))
     except InvalidPage:
@@ -54,6 +59,7 @@
     return render_to_response('bio/members.html', {
         'page': the_page,
         'type': type,
+        'num_members': num_members,
         }, 
         context_instance = RequestContext(request))