django_airavata/apps/auth/migrations/0014_auto_20220217_2255.py (13 lines of code) (raw):

# Generated by Django 3.2.10 on 2022-02-17 22:55 from django.db import migrations def reset_username_initialized_for_cilogon_usernames(apps, schema_editor): UserProfile = apps.get_model("django_airavata_auth", "UserProfile") # Update all existing user's user_profiles to have # username_initialized=False when the username is invalid because it is a # CILogon sub claim UserProfile.objects.filter( username_initialized=True, user__username__startswith="http://cilogon" ).update(username_initialized=False) class Migration(migrations.Migration): dependencies = [ ('django_airavata_auth', '0013_auto_20220118_1650'), ] operations = [ migrations.RunPython(reset_username_initialized_for_cilogon_usernames, migrations.RunPython.noop) ]