Private
Public Access
The setup view's User.objects.exists() check and the admin account's save() weren't in the same transaction, so two concurrent requests during first deployment could both pass the check and both create an admin account. SetupLock is a singleton row (pk=1); claiming it and creating the admin now happen in one atomic block, so only the first of any racing requests can succeed — the rest hit IntegrityError and are sent to the login page instead. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>