mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2025-09-03 01:56:16 +00:00
Don't run document checks if table doesn't exist yet
This commit is contained in:
@@ -1,4 +1,5 @@
|
|||||||
from django.core.checks import Warning, register
|
from django.core.checks import Warning, register
|
||||||
|
from django.db.utils import OperationalError
|
||||||
|
|
||||||
|
|
||||||
@register()
|
@register()
|
||||||
@@ -17,10 +18,12 @@ def changed_password_check(app_configs, **kwargs):
|
|||||||
"re-import them."
|
"re-import them."
|
||||||
)
|
)
|
||||||
|
|
||||||
document = Document.objects.order_by("-pk").filter(
|
try:
|
||||||
storage_type=Document.STORAGE_TYPE_GPG
|
document = Document.objects.order_by("-pk").filter(
|
||||||
).first()
|
storage_type=Document.STORAGE_TYPE_GPG).first()
|
||||||
|
if document and not GnuPG.decrypted(document.source_file):
|
||||||
|
return [Warning(warning.format(document))]
|
||||||
|
except OperationalError:
|
||||||
|
pass # No documents table yet
|
||||||
|
|
||||||
if document and not GnuPG.decrypted(document.source_file):
|
|
||||||
return [Warning(warning.format(document))]
|
|
||||||
return []
|
return []
|
||||||
|
Reference in New Issue
Block a user