Skip to content

Commit

Permalink
🩹 [#990] FIX wrong user redirect on form submit.
Browse files Browse the repository at this point in the history
  • Loading branch information
stefrado committed Nov 19, 2024
1 parent e8cb15b commit abc9b47
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/sdg/organisaties/views/roles.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,15 @@ def get_form_class(self):

raise PermissionDenied()

def get_success_url(self):
# Stay on the same page if the user is editing own settings and is not an admin.
if (
self.request.user.email == self.object.user.email
and self.object.is_beheerder is not True
):
return self.request.get_full_path()
return super().get_success_url()

def form_valid(self, form, *args, **kwargs):
response = super().form_valid(form)

Expand Down

0 comments on commit abc9b47

Please sign in to comment.