diff --git a/mayan/apps/documents/models.py b/mayan/apps/documents/models.py index 0805aef88c..3db0fe854d 100644 --- a/mayan/apps/documents/models.py +++ b/mayan/apps/documents/models.py @@ -281,6 +281,10 @@ class Document(models.Model): for document_version in self.versions.all(): document_version.invalidate_cache() + @property + def is_in_trash(self): + return self.in_trash + def natural_key(self): return (self.uuid,) natural_key.dependencies = ['documents.DocumentType'] @@ -566,6 +570,10 @@ class DocumentVersion(models.Model): for page in self.pages.all(): page.invalidate_cache() + @property + def is_in_trash(self): + return self.document.is_in_trash + def open(self, raw=False): """ Return a file descriptor to a document version's file irrespective of @@ -974,6 +982,10 @@ class DocumentPage(models.Model): for cached_image in self.cached_images.all(): cached_image.delete() + @property + def is_in_trash(self): + return self.document.is_in_trash + def natural_key(self): return (self.page_number, self.document_version.natural_key()) natural_key.dependencies = ['documents.DocumentVersion'] diff --git a/mayan/apps/documents/widgets.py b/mayan/apps/documents/widgets.py index 700faa98a7..3e49e8e361 100644 --- a/mayan/apps/documents/widgets.py +++ b/mayan/apps/documents/widgets.py @@ -60,7 +60,7 @@ class DocumentPageThumbnailWidget(object): template_name='documents/widgets/document_thumbnail.html', context={ # Disable the clickable link if the document is in the trash - 'disable_title_link': instance.in_trash, + 'disable_title_link': instance.is_in_trash, 'gallery_name': 'document_list', 'instance': instance, 'size_preview_width': setting_preview_width.value,