1 from django.contrib import admin
2 from django.db.models import F
3 from .models import SSHKey
6 class SSHKeyAdmin(admin.ModelAdmin):
7 fields = ['user', 'key', 'algorithm', 'bit_length', 'md5_hash', 'created_at', 'last_seen_at']
8 readonly_fields = ['algorithm', 'bit_length', 'md5_hash', 'created_at', 'last_seen_at']
9 list_display = ['comment', 'last_seen_at', 'user', 'md5_hash', 'algorithm', 'bit_length', 'created_at']
10 ordering = (F('last_seen_at').desc(nulls_last=True),)
12 admin.site.register(SSHKey, SSHKeyAdmin)