summaryrefslogtreecommitdiff
path: root/devel
diff options
context:
space:
mode:
authorDan McGee <dan@archlinux.org>2011-01-04 08:45:15 -0600
committerDan McGee <dan@archlinux.org>2011-03-10 10:49:11 -0600
commit1dc867587da6b66ca575eb26f4f65cb9d67ffdb3 (patch)
treece95e80d3e51e26f8ffaa6b522c3a18f13993bd4 /devel
parent3e73b5d7d291b20858b18ba7492b7f92501e01c7 (diff)
Add Admin log overview page
This puts the admin log functionality to a bit more use and allows seeing the last 100 overall entries. You can also drill down to see actions on a per-user basis. Signed-off-by: Dan McGee <dan@archlinux.org>
Diffstat (limited to 'devel')
-rw-r--r--devel/urls.py2
-rw-r--r--devel/views.py16
2 files changed, 17 insertions, 1 deletions
diff --git a/devel/urls.py b/devel/urls.py
index bcf9c071..41be2b31 100644
--- a/devel/urls.py
+++ b/devel/urls.py
@@ -5,6 +5,8 @@ urlpatterns = patterns('devel.views',
(r'^clock/$', 'clock'),
(r'^profile/$', 'change_profile'),
(r'^newuser/$', 'new_user_form'),
+ (r'^admin_log/(?P<username>.*)/$','admin_log'),
+ (r'^admin_log/$','admin_log'),
)
# vim: set ts=4 sw=4 et:
diff --git a/devel/views.py b/devel/views.py
index c926c5a4..46387f7a 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
@@ -169,4 +171,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: