diff options
Diffstat (limited to 'public')
-rw-r--r-- | public/views.py | 31 |
1 files changed, 20 insertions, 11 deletions
diff --git a/public/views.py b/public/views.py index 330f04b4..0ad1ca1c 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 from django.shortcuts import redirect @@ -18,20 +19,28 @@ def index(request): } return direct_to_template(request, 'public/index.html', context) -def userlist(request, type='Developers'): +USER_LISTS = { + 'devs': { + 'user_type': 'Hackers', + 'description': "This is a list of the current Parabola Hackers. They maintain the [libre] package repository and keep the [core], [extra] and [community] repositories clean of unfree software, in addition to doing any other developer duties.", + }, + 'fellows': { + 'user_type': 'Fellows', + 'description': "Below you can find a list of ex-hackers (aka project fellows). These folks helped make Parabola what it is today. Thanks!", + }, +} + +def userlist(request, type='hackers'): users = User.objects.order_by('username').select_related('userprofile') - if type == 'Hackers': + if type == 'hackers': users = users.filter(is_active=True, groups__name="Hackers") - msg = "This is a list of the current Parabola GNU/Linux hackers. They maintain the *-libre packages in addition to doing any other developer duties." - elif type == 'Fellows': - users = users.filter(is_active=False) - msg = "Below you can find a list of ex-hackers (aka project fellows). These folks helped make Parabola what it is today. Thanks!" + elif type == 'fellows': + users = users.filter(is_active=False, groups__name__in=["Hackers"]) + 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): |