summaryrefslogtreecommitdiff
path: root/devel/views.py
diff options
context:
space:
mode:
authorJohannes Krampf <johannes.krampf@gmail.com>2011-11-26 14:27:45 +0100
committerJohannes Krampf <johannes.krampf@gmail.com>2011-11-26 14:27:45 +0100
commit56c773b32fc68639eb55666b6cfaa32bc9618321 (patch)
treedcc047f0552224facb6d05cddf2fb72b973bd683 /devel/views.py
parentfbd23db51b7160a308cd88e407e676994eb08b10 (diff)
parent85657db05d7f65604340699cfcb9967c9e81a0ef (diff)
Merged with archweb trunk
Diffstat (limited to 'devel/views.py')
-rw-r--r--devel/views.py20
1 files changed, 15 insertions, 5 deletions
diff --git a/devel/views.py b/devel/views.py
index 27c32e7b..7cc45419 100644
--- a/devel/views.py
+++ b/devel/views.py
@@ -18,6 +18,7 @@ from main.models import Package, PackageDepend, PackageFile, TodolistPkg
from main.models import Arch, Repo
from main.models import UserProfile
from packages.models import PackageRelation
+from packages.utils import get_signoff_groups
from todolists.utils import get_annotated_todolists
from .utils import get_annotated_maintainers
@@ -31,7 +32,12 @@ from string import ascii_letters, digits
@never_cache
def index(request):
'''the developer dashboard'''
- inner_q = PackageRelation.objects.filter(user=request.user).values('pkgbase')
+ if(request.user.is_authenticated()):
+ inner_q = PackageRelation.objects.filter(user=request.user)
+ else:
+ inner_q = PackageRelation.objects.none()
+ inner_q = inner_q.values('pkgbase')
+
flagged = Package.objects.normal().filter(
flag_date__isnull=False, pkgbase__in=inner_q).order_by('pkgname')
@@ -43,6 +49,9 @@ def index(request):
todolists = get_annotated_todolists()
todolists = [todolist for todolist in todolists if todolist.incomplete_count > 0]
+ signoffs = sorted(get_signoff_groups(user=request.user),
+ key=operator.attrgetter('pkgbase'))
+
maintainers = get_annotated_maintainers()
maintained = PackageRelation.objects.filter(
@@ -65,6 +74,7 @@ def index(request):
'orphan': orphan,
'flagged' : flagged,
'todopkgs' : todopkgs,
+ 'signoffs': signoffs
}
return direct_to_template(request, 'devel/index.html', page_dict)
@@ -73,11 +83,11 @@ def index(request):
@never_cache
def clock(request):
devs = User.objects.filter(is_active=True).order_by(
- 'username').select_related('userprofile')
+ 'first_name', 'last_name').select_related('userprofile')
- # now annotate each dev object with their current time
now = datetime.now()
utc_now = datetime.utcnow().replace(tzinfo=pytz.utc)
+ # now annotate each dev object with their current time
for dev in devs:
tz = pytz.timezone(dev.userprofile.time_zone)
dev.current_time = utc_now.astimezone(tz)
@@ -142,12 +152,12 @@ def report(request, report, username=None):
if report == 'old':
title = 'Packages last built more than two years ago'
- cutoff = datetime.now() - timedelta(days=365 * 2)
+ cutoff = datetime.utcnow() - timedelta(days=365 * 2)
packages = packages.filter(
build_date__lt=cutoff).order_by('build_date')
elif report == 'long-out-of-date':
title = 'Packages marked out-of-date more than 90 days ago'
- cutoff = datetime.now() - timedelta(days=90)
+ cutoff = datetime.utcnow() - timedelta(days=90)
packages = packages.filter(
flag_date__lt=cutoff).order_by('flag_date')
elif report == 'big':