Skip to content

Commit

Permalink
Update import from guardian
Browse files Browse the repository at this point in the history
Get rid of deprecation warning triggered by the fact that assign has
been renamed to assign_perm.
  • Loading branch information
amarandon committed Nov 11, 2013
1 parent 5beff39 commit 0eda744
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions userena/managers.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
get_user_model
from userena import signals as userena_signals

from guardian.shortcuts import assign, get_perms
from guardian.shortcuts import assign_perm, get_perms


import re, datetime

Expand Down Expand Up @@ -75,11 +76,11 @@ def create_user(self, username, email, password, active=False,

# Give permissions to view and change profile
for perm in ASSIGNED_PERMISSIONS['profile']:
assign(perm[0], new_user, new_profile)
assign_perm(perm[0], new_user, new_profile)

# Give permissions to view and change itself
for perm in ASSIGNED_PERMISSIONS['user']:
assign(perm[0], new_user, new_user)
assign_perm(perm[0], new_user, new_user)

if send_email:
userena_profile.send_activation_email()
Expand Down Expand Up @@ -281,7 +282,7 @@ def check_permissions(self):

for perm in perms:
if perm[0] not in all_permissions:
assign(perm[0], user, perm_object)
assign_perm(perm[0], user, perm_object)
changed_users.append(user)

return (changed_permissions, changed_users, warnings)
Expand Down

0 comments on commit 0eda744

Please sign in to comment.