mirror of
				https://github.com/paperless-ngx/paperless-ngx.git
				synced 2025-10-30 03:56:23 -05: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.db.utils import OperationalError | ||||
|  | ||||
|  | ||||
| @register() | ||||
| @@ -17,10 +18,12 @@ def changed_password_check(app_configs, **kwargs): | ||||
|         "re-import them." | ||||
|     ) | ||||
|  | ||||
|     document = Document.objects.order_by("-pk").filter( | ||||
|         storage_type=Document.STORAGE_TYPE_GPG | ||||
|     ).first() | ||||
|     try: | ||||
|         document = Document.objects.order_by("-pk").filter( | ||||
|             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 [] | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Daniel Quinn
					Daniel Quinn