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:
Roberto Rosario
2018-12-22 05:35:31 -04:00
parent 360e756093
commit 64e1c6bb67
59 changed files with 450 additions and 402 deletions

View File

@@ -181,6 +181,10 @@ class DocumentVersion(models.Model):
)
raise
def get_page_count(self):
return self.pages.count()
get_page_count.short_description = _('Pages')
def get_rendered_string(self, preserve_extension=False):
if preserve_extension:
filename, extension = os.path.splitext(self.document.label)
@@ -196,6 +200,7 @@ class DocumentVersion(models.Model):
return Template('{{ instance.timestamp }}').render(
context=Context({'instance': self})
)
get_rendered_timestamp.short_description = _('Date and time')
def natural_key(self):
return (self.checksum, self.document.natural_key())