Mercurial > public > sg101
comparison 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 |
comparison
equal
deleted
inserted
replaced
146:023132c90021 | 147:152d77265da6 |
---|---|
28 | 28 |
29 ####################################################################### | 29 ####################################################################### |
30 | 30 |
31 @login_required | 31 @login_required |
32 def member_list(request, type='user', page=1): | 32 def member_list(request, type='user', page=1): |
33 """ | |
34 This view displays the member list. Only active members are displayed. | |
35 """ | |
36 qs = auth.models.User.objects.filter(is_active=True) | |
33 if type == 'user': | 37 if type == 'user': |
34 users = auth.models.User.objects.all().order_by('username') | 38 qs = qs.order_by('username') |
35 else: | 39 else: |
36 users = auth.models.User.objects.all().order_by('date_joined') | 40 qs = qs.order_by('date_joined') |
37 | 41 num_members = qs.count() |
38 paginator = DiggPaginator(users, 10, body=5, tail=3, margin=3, padding=2) | 42 |
43 paginator = DiggPaginator(qs, 20, body=5, tail=3, margin=3, padding=2) | |
39 try: | 44 try: |
40 the_page = paginator.page(int(page)) | 45 the_page = paginator.page(int(page)) |
41 except InvalidPage: | 46 except InvalidPage: |
42 raise Http404 | 47 raise Http404 |
43 | 48 |
52 user.user_profile = user_profiles[user.id] | 57 user.user_profile = user_profiles[user.id] |
53 | 58 |
54 return render_to_response('bio/members.html', { | 59 return render_to_response('bio/members.html', { |
55 'page': the_page, | 60 'page': the_page, |
56 'type': type, | 61 'type': type, |
62 'num_members': num_members, | |
57 }, | 63 }, |
58 context_instance = RequestContext(request)) | 64 context_instance = RequestContext(request)) |
59 | 65 |
60 ####################################################################### | 66 ####################################################################### |
61 | 67 |