Skip to content

Commit

Permalink
Merge pull request #63 from benwad/custom-signup-redirect
Browse files Browse the repository at this point in the history
Added get_signup_redirect to allow custom implementations by subclasses
  • Loading branch information
bee-keeper committed Feb 3, 2017
2 parents 6ec597a + 61ed47d commit a655c73
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions invitations/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,9 @@ def post(self, request, *args, **kwargs):
class AcceptInvite(SingleObjectMixin, View):
form_class = InviteForm

def get_signup_redirect(self):
return app_settings.SIGNUP_REDIRECT

def get(self, *args, **kwargs):
if app_settings.CONFIRM_INVITE_ON_GET:
return self.post(*args, **kwargs)
Expand Down Expand Up @@ -136,7 +139,7 @@ def post(self, *args, **kwargs):
'invitations/messages/invite_expired.txt',
{'email': invitation.email})
# Redirect to sign-up since they might be able to register anyway.
return redirect(app_settings.SIGNUP_REDIRECT)
return redirect(self.get_signup_redirect())

# The invitation is valid.
# Mark it as accepted now if ACCEPT_INVITE_AFTER_SIGNUP is False.
Expand All @@ -148,7 +151,7 @@ def post(self, *args, **kwargs):
get_invitations_adapter().stash_verified_email(
self.request, invitation.email)

return redirect(app_settings.SIGNUP_REDIRECT)
return redirect(self.get_signup_redirect())

def get_object(self, queryset=None):
if queryset is None:
Expand Down

0 comments on commit a655c73

Please sign in to comment.