diff options
author | Dan McGee <dan@archlinux.org> | 2011-12-07 13:04:34 -0600 |
---|---|---|
committer | Dan McGee <dan@archlinux.org> | 2011-12-07 13:04:34 -0600 |
commit | 7b6ec8662a306c5754dbe4fe2484de61284942ac (patch) | |
tree | e987c0409c21247341d718ba65f2364181e30ce3 /devel | |
parent | 94c5bda1c13960f8626b3c8e8ec47d9e3005f792 (diff) |
Enhance devel model admin
Signed-off-by: Dan McGee <dan@archlinux.org>
Diffstat (limited to 'devel')
-rw-r--r-- | devel/admin.py | 11 | ||||
-rw-r--r-- | devel/models.py | 10 |
2 files changed, 19 insertions, 2 deletions
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: |