summaryrefslogtreecommitdiffstats
path: root/devel/admin.py
blob: 971933b7c240c2b315d8f91f5c95fb0105008366 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
from django.contrib import admin
from django.contrib.auth.admin import UserAdmin
from django.contrib.auth.models import User

from .models import UserProfile, MasterKey, DeveloperKey, PGPSignature


class UserProfileInline(admin.StackedInline):
    model = UserProfile


class UserProfileAdmin(UserAdmin):
    inlines = [UserProfileInline]
    list_display = ('username', 'email', 'first_name', 'last_name', 'is_staff', 'is_active')
    list_filter = ('is_staff', 'is_superuser', 'is_active')


class MasterKeyAdmin(admin.ModelAdmin):
    list_display = ('pgp_key', 'owner', 'created', 'revoker', 'revoked')
    search_fields = ('pgp_key', 'owner__username', 'revoker__username')
    date_hierarchy = 'created'


class DeveloperKeyAdmin(admin.ModelAdmin):
    list_display = ('key', 'parent', 'owner', 'created', 'expires', 'revoked')
    search_fields = ('key', 'owner__username')
    list_filter = ('owner',)
    date_hierarchy = 'created'


class PGPSignatureAdmin(admin.ModelAdmin):
    list_display = ('signer', 'signee', 'created', 'expires', 'valid')
    list_filter = ('valid',)
    search_fields = ('signer', 'signee')
    date_hierarchy = 'created'


admin.site.unregister(User)
admin.site.register(User, UserProfileAdmin)

admin.site.register(MasterKey, MasterKeyAdmin)
admin.site.register(DeveloperKey, DeveloperKeyAdmin)
admin.site.register(PGPSignature, PGPSignatureAdmin)

# vim: set ts=4 sw=4 et: