Skip to content

Commit

Permalink
Add check for self.activated.
Browse files Browse the repository at this point in the history
  • Loading branch information
wlorenzetti committed Oct 25, 2023
1 parent 46ca74e commit 9984f7c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions g3w-admin/editing/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ def form_valid(self, form):

# give permission to viewers:
toAdd = toRemove = None
if self.activated.pk:
if self.activated and self.activated.pk:
currentViewerUsers = [int(i) for i in form.cleaned_data['viewer_users']]
toRemove = list(set(self.initial_viewer_users) - set(currentViewerUsers))
toAdd = list(set(currentViewerUsers) - set(self.initial_viewer_users))
Expand All @@ -296,7 +296,7 @@ def form_valid(self, form):

# give permission to user groups viewers:
to_add = to_remove = None
if self.activated.pk:
if self.activated and self.activated.pk:
current_user_groups_viewers = [int(i) for i in form.cleaned_data['user_groups_viewer']]
to_remove = list(set(self.initial_viewer_user_groups) - set(current_user_groups_viewers))
to_add = list(set(current_user_groups_viewers) - set(self.initial_viewer_user_groups))
Expand Down

0 comments on commit 9984f7c

Please sign in to comment.