summaryrefslogtreecommitdiff
path: root/public
diff options
context:
space:
mode:
authorLuke Shumaker <lukeshu@sbcglobal.net>2015-04-15 21:55:11 -0400
committerLuke Shumaker <lukeshu@sbcglobal.net>2015-04-15 21:55:11 -0400
commit29ffe1b85ba4bf077d529603982d5bd810c68a1f (patch)
tree9bb2ea435ac5b7554bfc555b3c3877ea26e43087 /public
parentce1f17e5104d44fa833090c47dd76466a2d7f743 (diff)
parent86bd3d5e4920fd6d57ac51ed3abf02d2f368f2a7 (diff)
Merge branch 'archweb-generic'
Diffstat (limited to 'public')
-rw-r--r--public/views.py38
1 files changed, 9 insertions, 29 deletions
diff --git a/public/views.py b/public/views.py
index 57634983..1b79e7c8 100644
--- a/public/views.py
+++ b/public/views.py
@@ -5,11 +5,11 @@ from operator import attrgetter
from django.conf import settings
from django.contrib.auth.models import User
from django.db.models import Count, Q
-from django.http import Http404, HttpResponse
-from django.shortcuts import render
+from django.http import HttpResponse
+from django.shortcuts import get_object_or_404, render
from django.views.decorators.cache import cache_control, cache_page
-from devel.models import MasterKey, PGPSignature
+from devel.models import MasterKey, PGPSignature, StaffGroup
from main.models import Arch, Repo, Donor
from mirrors.models import MirrorUrl
from news.models import News
@@ -28,38 +28,18 @@ def index(request):
context = {
'news_updates': News.objects.order_by('-postdate', '-id')[:15],
'pkg_updates': updates,
+ 'staff_groups': StaffGroup.objects.all(),
}
return render(request, 'public/index.html', context)
-USER_LISTS = {
- 'hackers': {
- 'user_type': 'Hackers',
- 'user_title': 'Hacker',
- 'description': "This is a list of the current "+settings.BRANDING_SHORTNAME+" 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',
- 'user_title': 'Fellow',
- 'description': "Below you can find a list of ex-hackers (aka project fellows). These folks helped make "+settings.BRANDING_SHORTNAME+" what it is today. Thanks!",
- },
-}
-
@cache_control(max_age=307)
-def userlist(request, user_type='hackers'):
- users = User.objects.order_by(
- 'username').select_related('userprofile')
- if user_type == 'hackers':
- users = users.filter(is_active=True, groups__name="Hackers")
- elif user_type == 'fellows':
- users = users.filter(is_active=False,
- groups__name__in=["Hackers"])
- else:
- raise Http404
+def people(request, slug):
+ group = get_object_or_404(StaffGroup, slug=slug)
+ users = User.objects.filter(groups=group.group).order_by(
+ 'first_name', 'last_name').select_related('userprofile')
- users = users.distinct()
- context = USER_LISTS[user_type].copy()
- context['users'] = users
+ context = {'group': group, 'users': users}
return render(request, 'public/userlist.html', context)