def add_anonymous_profile(apps, schema_editor):
 User = apps.get_model(u'auth', u'User')
 Group = apps.get_model(u'auth', u'Group')
 Profile = apps.get_model(u'accounts', u'Profile')
 anon_user = User.objects.get_or_create(username=ANONYMOUS_USER_NAME, defaults={u'is_active': False, u'password': make_password(None), u'email': u'noreply@weblate.org'})[0]
 guest_group = Group.objects.get_or_create(name=u'Guests')[0]
 anon_user.groups.clear()
 anon_user.groups.add(guest_group)
 Profile.objects.get_or_create(user=anon_user)

def add_anonymous_profile ( apps , schema_editor ) : User = apps . get_model ( u'auth' , u'User' ) Group = apps . get_model ( u'auth' , u'Group' ) Profile = apps . get_model ( u'accounts' , u'Profile' ) anon_user = User . objects . get_or_create ( username = ANONYMOUS_USER_NAME , defaults = { u'is_active' : False , u'password' : make_password ( None ) , u'email' : u'noreply@weblate.org' } ) [ 0 ] guest_group = Group . objects . get_or_create ( name = u'Guests' ) [ 0 ] anon_user . groups . clear ( ) anon_user . groups . add ( guest_group ) Profile . objects . get_or_create ( user = anon_user )
ensure anonymous user has profile .