File tree Expand file tree Collapse file tree 1 file changed +3
-1
lines changed Expand file tree Collapse file tree 1 file changed +3
-1
lines changed Original file line number Diff line number Diff line change 13
13
def populate_askbot_roles (apps , schema_editor ):
14
14
Role = apps .get_model ('askbot' , 'Role' )
15
15
UserProfile = apps .get_model ('askbot' , 'UserProfile' )
16
+ User = apps .get_model ('auth' , 'User' )
16
17
profiles = UserProfile .objects .filter (status__in = ('m' , 'd' ))
17
18
count = profiles .count ()
18
19
message = 'Assigning roles {} to the admins and the moderators'
19
20
message = message .format (', ' .join (MOD_ROLES + ADMIN_ROLES ))
20
21
for profile in ProgressBar (profiles .iterator (), count , message ):
21
- user = profile .auth_user_ptr
22
+ user_id = profile .auth_user_ptr_id
23
+ user = User .objects .filter (id = user_id )[0 ]
22
24
if profile .status == 'd' :
23
25
for role in ADMIN_ROLES + MOD_ROLES :
24
26
Role .objects .create (user = user , role = role )
You can’t perform that action at this time.
0 commit comments