From 7b6ec8662a306c5754dbe4fe2484de61284942ac Mon Sep 17 00:00:00 2001 From: Dan McGee Date: Wed, 7 Dec 2011 13:04:34 -0600 Subject: Enhance devel model admin Signed-off-by: Dan McGee --- devel/admin.py | 11 ++++++++++- devel/models.py | 10 +++++++++- 2 files changed, 19 insertions(+), 2 deletions(-) (limited to 'devel') diff --git a/devel/admin.py b/devel/admin.py index 84082fb8..717ba1b2 100644 --- a/devel/admin.py +++ b/devel/admin.py @@ -1,12 +1,21 @@ from django.contrib import admin -from .models import MasterKey +from .models import MasterKey, PGPSignature class MasterKeyAdmin(admin.ModelAdmin): list_display = ('pgp_key', 'owner', 'created', 'revoker', 'revoked') search_fields = ('pgp_key', 'owner', 'revoker') + 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.register(MasterKey, MasterKeyAdmin) +admin.site.register(PGPSignature, PGPSignatureAdmin) # vim: set ts=4 sw=4 et: diff --git a/devel/models.py b/devel/models.py index 6c97375c..e46fbba1 100644 --- a/devel/models.py +++ b/devel/models.py @@ -1,3 +1,4 @@ +# -*- coding: utf-8 -*- from django.db import models from django.contrib.auth.models import User @@ -17,6 +18,10 @@ class MasterKey(models.Model): class Meta: ordering = ('created',) + def __unicode__(self): + return u'%s, created %s' % ( + self.owner.get_full_name(), self.created) + class PGPSignature(models.Model): signer = PGPKeyField(max_length=40, verbose_name="PGP key fingerprint", @@ -24,10 +29,13 @@ class PGPSignature(models.Model): signee = PGPKeyField(max_length=40, verbose_name="PGP key fingerprint", help_text="consists of 40 hex digits; use `gpg --fingerprint`") created = models.DateField() - expires = models.DateField(null=True) + expires = models.DateField(null=True, blank=True) valid = models.BooleanField(default=True) class Meta: verbose_name = 'PGP signature' + def __unicode__(self): + return u'%s → %s' % (self.signer, self.signee) + # vim: set ts=4 sw=4 et: -- cgit v1.2.3-54-g00ecf