Just display the signature type to conserve UI space.

This commit is contained in:
Roberto Rosario
2016-03-28 14:57:19 -04:00
parent e5c47f16d4
commit c1cb983869
2 changed files with 17 additions and 18 deletions

View File

@@ -82,31 +82,18 @@ class DocumentSignaturesApp(MayanAppConfig):
source=SignatureBaseModel, label=_('Date'), attribute='date' source=SignatureBaseModel, label=_('Date'), attribute='date'
) )
SourceColumn( SourceColumn(
source=SignatureBaseModel, label=_('Key ID'), attribute='key_id' source=SignatureBaseModel, label=_('Key ID'),
attribute='get_key_id'
) )
SourceColumn( SourceColumn(
source=SignatureBaseModel, label=_('Signature ID'), source=SignatureBaseModel, label=_('Signature ID'),
func=lambda context: context['object'].signature_id or _('None') func=lambda context: context['object'].signature_id or _('None')
) )
SourceColumn(
source=SignatureBaseModel, label=_('Public key fingerprint'),
func=lambda context: context['object'].public_key_fingerprint or _('None')
)
SourceColumn( SourceColumn(
source=SignatureBaseModel, label=_('Is embedded?'), source=SignatureBaseModel, label=_('Is embedded?'),
func=lambda context: two_state_template( func=lambda context: SignatureBaseModel.objects.get_subclass(
SignatureBaseModel.objects.get_subclass( pk=context['object'].pk
pk=context['object'].pk ).get_signature_type_display()
).is_embedded
)
)
SourceColumn(
source=SignatureBaseModel, label=_('Is detached?'),
func=lambda context: two_state_template(
SignatureBaseModel.objects.get_subclass(
pk=context['object'].pk
).is_detached
)
) )
app.conf.CELERY_QUEUES.append( app.conf.CELERY_QUEUES.append(

View File

@@ -60,6 +60,18 @@ class SignatureBaseModel(models.Model):
args=(self.pk,) args=(self.pk,)
) )
def get_key_id(self):
if self.public_key_fingerprint:
return self.public_key_fingerprint[-16:]
else:
return self.key_id
def get_signature_type_display(self):
if self.is_detached:
return _('Detached')
else:
return _('Embedded')
@property @property
def is_detached(self): def is_detached(self):
return hasattr(self, 'signature_file') return hasattr(self, 'signature_file')