From 32308f0cf6d036642c0645b306120565b3240e8d Mon Sep 17 00:00:00 2001 From: shamoon <4887959+shamoon@users.noreply.github.com> Date: Wed, 26 Mar 2025 14:27:52 -0700 Subject: [PATCH] Refactor a bit, include doc count --- src/documents/context_processors.py | 6 ++++-- src/documents/templates/account/login.html | 2 +- src/documents/templates/account/signup.html | 6 +++--- src/paperless/adapter.py | 6 +++++- 4 files changed, 13 insertions(+), 7 deletions(-) diff --git a/src/documents/context_processors.py b/src/documents/context_processors.py index 8c9d22a28..32c73da10 100644 --- a/src/documents/context_processors.py +++ b/src/documents/context_processors.py @@ -1,6 +1,7 @@ from django.conf import settings as django_settings from django.contrib.auth.models import User +from documents.models import Document from paperless.config import GeneralConfig @@ -26,8 +27,9 @@ def settings(request): "domain": getattr(django_settings, "PAPERLESS_URL", request.get_host()), "APP_TITLE": app_title, "APP_LOGO": app_logo, - "HAS_USERS": User.objects.exclude( + "FIRST_INSTALL": User.objects.exclude( username__in=["consumer", "AnonymousUser"], ).count() - > 0, + == 0 + and Document.objects.count() == 0, } diff --git a/src/documents/templates/account/login.html b/src/documents/templates/account/login.html index 94cb91630..767c21d7c 100644 --- a/src/documents/templates/account/login.html +++ b/src/documents/templates/account/login.html @@ -15,7 +15,7 @@ {% endblock form_top_content %} {% block form_content %} - {% if not HAS_USERS %} + {% if FIRST_INSTALL %}