Use global_objects

This commit is contained in:
shamoon 2025-03-26 15:48:23 -07:00
parent 2a272e85dd
commit 66d16f2fb2
No known key found for this signature in database
2 changed files with 3 additions and 3 deletions

View File

@ -31,5 +31,5 @@ def settings(request):
username__in=["consumer", "AnonymousUser"], username__in=["consumer", "AnonymousUser"],
).count() ).count()
== 0 == 0
and Document.objects.count() == 0, and Document.global_objects.count() == 0,
} }

View File

@ -25,7 +25,7 @@ class CustomAccountAdapter(DefaultAccountAdapter):
if ( if (
User.objects.exclude(username__in=["consumer", "AnonymousUser"]).count() User.objects.exclude(username__in=["consumer", "AnonymousUser"]).count()
== 0 == 0
and Document.objects.count() == 0 and Document.global_objects.count() == 0
): ):
# I.e. a fresh install, allow signups # I.e. a fresh install, allow signups
return True return True
@ -85,7 +85,7 @@ class CustomAccountAdapter(DefaultAccountAdapter):
if ( if (
User.objects.exclude(username__in=["consumer", "AnonymousUser"]).count() User.objects.exclude(username__in=["consumer", "AnonymousUser"]).count()
== 0 == 0
and Document.objects.count() == 0 and Document.global_objects.count() == 0
): ):
# I.e. a fresh install, make the user a superuser # I.e. a fresh install, make the user a superuser
logger.debug(f"Creating initial superuser `{user}`") logger.debug(f"Creating initial superuser `{user}`")