From 6a9c66ff3f276a8045377b6ba27443d9a016e329 Mon Sep 17 00:00:00 2001 From: Roberto Rosario Date: Fri, 30 Jun 2017 17:47:01 -0400 Subject: [PATCH] Return False for the document's exists() method when it doesn't have a document version. Signed-off-by: Roberto Rosario --- mayan/apps/documents/models.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/mayan/apps/documents/models.py b/mayan/apps/documents/models.py index a21bc3db7d..04325b8ed1 100644 --- a/mayan/apps/documents/models.py +++ b/mayan/apps/documents/models.py @@ -237,7 +237,11 @@ class Document(models.Model): Returns a boolean value that indicates if the document's latest version file exists in storage """ - return self.latest_version.exists() + latest_version = self.latest_version + if latest_version: + return latest_version.exists() + else: + return False def invalidate_cache(self): for document_version in self.versions.all():