summaryrefslogtreecommitdiff
path: root/public
diff options
context:
space:
mode:
authorDan McGee <dan@archlinux.org>2011-02-27 11:52:27 -0600
committerDan McGee <dan@archlinux.org>2011-02-27 11:52:27 -0600
commit5cd223680e35e90bfc39ae22a4638204d0beaa98 (patch)
tree7a1603161aa283043fba8f773485034bcd05adb6 /public
parent1fe833e18d2f7db563302f18f71e3a07e27b169c (diff)
Slight refactor of user list views
Signed-off-by: Dan McGee <dan@archlinux.org>
Diffstat (limited to 'public')
-rw-r--r--public/views.py36
1 files changed, 24 insertions, 12 deletions
diff --git a/public/views.py b/public/views.py
index 551e1e18..46291b88 100644
--- a/public/views.py
+++ b/public/views.py
@@ -5,6 +5,7 @@ from . import utils
from django.contrib.auth.models import User
from django.db.models import Q
+from django.http import Http404
from django.views.generic import list_detail
from django.views.generic.simple import direct_to_template
@@ -17,23 +18,34 @@ def index(request):
}
return direct_to_template(request, 'public/index.html', context)
-def userlist(request, type='Developers'):
+USER_LISTS = {
+ 'devs': {
+ 'user_type': 'Developers',
+ 'description': "This is a list of the current Arch Linux Developers. They maintain the [core] and [extra] package repositories in addition to doing any other developer duties.",
+ },
+ 'tus': {
+ 'user_type': 'Trusted Users',
+ 'description': "Here are all your friendly Arch Linux Trusted Users who are in charge of the [community] repository.",
+ },
+ 'fellows': {
+ 'user_type': 'Fellows',
+ 'description': "Below you can find a list of ex-developers (aka project fellows). These folks helped make Arch what it is today. Thanks!",
+ },
+}
+
+def userlist(request, type='devs'):
users = User.objects.order_by('username').select_related('userprofile')
- if type == 'Developers':
+ if type == 'devs':
users = users.filter(is_active=True, groups__name="Developers")
- msg = "This is a list of the current Arch Linux Developers. They maintain the [core] and [extra] package repositories in addition to doing any other developer duties."
- elif type == 'Trusted Users':
+ elif type == 'tus':
users = users.filter(is_active=True, groups__name="Trusted Users")
- msg = "Here are all your friendly Arch Linux Trusted Users who are in charge of the [community] repository."
- elif type == 'Fellows':
+ elif type == 'fellows':
users = users.filter(is_active=False, groups__name__in=["Developers", "Trusted Users"])
- msg = "Below you can find a list of ex-developers (aka project fellows). These folks helped make Arch what it is today. Thanks!"
+ else:
+ raise Http404
- context = {
- 'user_type': type,
- 'description': msg,
- 'users': users,
- }
+ context = USER_LISTS[type].copy()
+ context['users'] = users
return direct_to_template(request, 'public/userlist.html', context)
def donate(request):