Add widget support to SourceColumn
Allow passing a widget class to SourceColumn. This makes using lambdas to render model column unnecesary and are mostly removed too. Signed-off-by: Roberto Rosario <Roberto.Rosario@mayan-edms.com>
This commit is contained in:
@@ -44,22 +44,24 @@ class DjangoGPGApp(MayanAppConfig):
|
||||
)
|
||||
)
|
||||
|
||||
SourceColumn(source=Key, label=_('Key ID'), attribute='key_id')
|
||||
SourceColumn(source=Key, label=_('User ID'), attribute='user_id')
|
||||
SourceColumn(attribute='key_id', is_identifier=True, source=Key)
|
||||
SourceColumn(attribute='user_id', source=Key)
|
||||
|
||||
SourceColumn(source=KeyStub, label=_('Key ID'), attribute='key_id')
|
||||
SourceColumn(source=KeyStub, label=_('Type'), attribute='key_type')
|
||||
SourceColumn(
|
||||
source=KeyStub, label=_('Creation date'), attribute='date'
|
||||
attribute='key_id.fget', is_identifier=True, source=KeyStub
|
||||
)
|
||||
SourceColumn(attribute='key_type', label=_('Type'), source=KeyStub)
|
||||
SourceColumn(
|
||||
attribute='date', label=_('Creation date'), source=KeyStub
|
||||
)
|
||||
SourceColumn(
|
||||
source=KeyStub, label=_('Expiration date'),
|
||||
func=lambda context: context['object'].expires or _('No expiration')
|
||||
attribute='expires', empty_value=_('No expiration'),
|
||||
label=_('Expiration date'), source=KeyStub
|
||||
)
|
||||
SourceColumn(source=KeyStub, label=_('Length'), attribute='length')
|
||||
SourceColumn(attribute='length', label=_('Length'), source=KeyStub)
|
||||
SourceColumn(
|
||||
source=KeyStub, label=_('User ID'),
|
||||
func=lambda context: ', '.join(context['object'].user_id)
|
||||
func=lambda context: ', '.join(context['object'].user_id),
|
||||
label=_('User ID'), source=KeyStub
|
||||
)
|
||||
|
||||
menu_object.bind_links(links=(link_key_detail,), sources=(Key,))
|
||||
|
||||
@@ -6,6 +6,8 @@ import shutil
|
||||
|
||||
import gnupg
|
||||
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
|
||||
from mayan.apps.common.utils import mkdtemp
|
||||
|
||||
|
||||
@@ -149,6 +151,7 @@ class KeyStub(object):
|
||||
@property
|
||||
def key_id(self):
|
||||
return self.fingerprint[-8:]
|
||||
key_id.fget.short_description = _('Key ID')
|
||||
|
||||
|
||||
class SignatureVerification(object):
|
||||
|
||||
@@ -85,6 +85,7 @@ class Key(models.Model):
|
||||
Short form key ID (using the first 8 characters).
|
||||
"""
|
||||
return self.fingerprint[-8:]
|
||||
key_id.fget.short_description = _('Key ID')
|
||||
|
||||
def save(self, *args, **kwargs):
|
||||
import_results, key_info = gpg_backend.import_and_list_keys(
|
||||
|
||||
Reference in New Issue
Block a user