From 6e195df483a180c711531667a6e2845d83b56296 Mon Sep 17 00:00:00 2001 From: Hidden Z Date: Thu, 28 Oct 2010 19:08:40 +0000 Subject: [PATCH] web/postkey/admin.py: initial admin interface for hosts managing --- web/postkey/admin.py | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 web/postkey/admin.py diff --git a/web/postkey/admin.py b/web/postkey/admin.py new file mode 100644 index 0000000..21ff982 --- /dev/null +++ b/web/postkey/admin.py @@ -0,0 +1,27 @@ +from postkey.models import i2phost +from postkey.models import PendingHost +from django.contrib import admin + +class i2phostAdmin(admin.ModelAdmin): + def url(self, hostname): + return 'look' + url.allow_tags = True + + list_display = ('url', 'name', 'description', 'date_added', 'last_seen', 'expires', + 'activated', 'external') + list_display_links = ['name'] + list_filter = ('activated', 'external', 'approved') + search_fields = ['name'] + ordering = ['date_added'] + +class PendingAdmin(i2phostAdmin): + def queryset(self, request): + qs = super(PendingAdmin, self).queryset(request) + return qs.filter(approved=False) + + list_filter = [] + list_display = ('url', 'name', 'description', 'date_added', 'last_seen', 'expires', 'approved') + list_editable = ['approved'] + +admin.site.register(i2phost, i2phostAdmin) +admin.site.register(PendingHost, PendingAdmin)