1
0
mirror of https://github.com/r4sas/py-i2phosts synced 2025-01-08 22:07:55 +00:00

web/postkey/admin.py: initial admin interface for hosts managing

This commit is contained in:
Hidden Z 2010-10-28 19:08:40 +00:00
parent 01f13f2208
commit 6e195df483

27
web/postkey/admin.py Normal file
View File

@ -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 '<a href=http://' + hostname.name + '>look</a>'
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)