Skip to content

How to reset system access step onboarding status of all users

Chandra Y edited this page Oct 15, 2024 · 1 revision
  1. Connect to portal_django (core_portal_django, if you are on local dev) docker exec -it portal_django /bin/bash
  2. attach to shell python3 manage.py shell
  3. run
from django.contrib.auth.models import User
from django.core.exceptions import ObjectDoesNotExist
from portal.apps.onboarding.steps.system_access_v3 import SystemAccessStepV3

users = User.objects.all()
for u in users:
    try:
        u.profile.setup_complete = False
        u.profile.save()
        setup_step = SystemAccessStepV3(u)
        setup_step.prepare()
        setup_step.user.profile.setup_complete = False
        setup_step.user.profile.save()
    except ObjectDoesNotExist:
        print(f"Profile not found for user: {u.username}")
        continue
Clone this wiki locally