summaryrefslogtreecommitdiff
path: root/public/views.py
diff options
context:
space:
mode:
Diffstat (limited to 'public/views.py')
-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):