summaryrefslogtreecommitdiff
path: root/devel/views.py
diff options
context:
space:
mode:
authorNicolás Reynolds <fauno@kiwwwi.com.ar>2011-03-18 16:11:31 -0300
committerNicolás Reynolds <fauno@kiwwwi.com.ar>2011-03-18 16:11:31 -0300
commit37075e5f3423a69fec03faf31ce2133c55374dfc (patch)
tree7403d5eefd5f20ab2a496dbbb9d9841b06e2e385 /devel/views.py
parent30b2a1954d5bf63c78fe654a0c0bb98508e2f3e2 (diff)
parentaca7700dd7519d45e677e18b1a0199f3712ce140 (diff)
Merge branch 'master' of git://projects.archlinux.org/archweb
Conflicts: templates/packages/details.html templates/packages/files.html
Diffstat (limited to 'devel/views.py')
-rw-r--r--devel/views.py31
1 files changed, 29 insertions, 2 deletions
diff --git a/devel/views.py b/devel/views.py
index 311922ca..5b8965d8 100644
--- a/devel/views.py
+++ b/devel/views.py
@@ -1,9 +1,11 @@
from django import forms
from django.http import HttpResponseRedirect
-from django.contrib.auth.decorators import login_required, permission_required
+from django.contrib.auth.decorators import \
+ login_required, permission_required, user_passes_test
from django.contrib.auth.models import User
from django.contrib.sites.models import Site
from django.core.mail import send_mail
+from django.shortcuts import get_object_or_404
from django.template import loader, Context
from django.views.decorators.cache import never_cache
from django.views.generic.simple import direct_to_template
@@ -34,11 +36,22 @@ def index(request):
maintainers = get_annotated_maintainers()
+ maintained = PackageRelation.objects.filter(
+ type=PackageRelation.MAINTAINER).values('pkgbase')
+ total_orphans = Package.objects.exclude(pkgbase__in=maintained).count()
+ total_flagged_orphans = Package.objects.filter(
+ flag_date__isnull=False).exclude(pkgbase__in=maintained).count()
+ orphan = {
+ 'package_count': total_orphans,
+ 'flagged_count': total_flagged_orphans,
+ }
+
page_dict = {
'todos': Todolist.objects.incomplete().order_by('-date_added'),
'repos': Repo.objects.all(),
'arches': Arch.objects.all(),
'maintainers': maintainers,
+ 'orphan': orphan,
'flagged' : flagged,
'todopkgs' : todopkgs,
}
@@ -55,7 +68,9 @@ def clock(request):
now = datetime.datetime.now()
utc_now = datetime.datetime.utcnow().replace(tzinfo=pytz.utc)
for dev in devs:
- tz = pytz.timezone(dev.userprofile.time_zone)
+ # Work around https://bugs.launchpad.net/pytz/+bug/718673
+ timezone = str(dev.userprofile.time_zone)
+ tz = pytz.timezone(timezone)
dev.current_time = utc_now.astimezone(tz)
page_dict = {
@@ -167,4 +182,16 @@ def new_user_form(request):
}
return direct_to_template(request, 'general_form.html', context)
+@user_passes_test(lambda u: u.is_superuser)
+@never_cache
+def admin_log(request, username=None):
+ user = None
+ if username:
+ user = get_object_or_404(User, username=username)
+ context = {
+ 'title': "Admin Action Log",
+ 'log_user': user,
+ }
+ return direct_to_template(request, 'devel/admin_log.html', context)
+
# vim: set ts=4 sw=4 et: