jazzband / django-invitations

Generic invitations app for Django
GNU General Public License v3.0
558 stars 166 forks source link

allow Invitation key to be passed to the redirected url #204

Closed shawnzam closed 3 months ago

shawnzam commented 1 year ago

Allow the Invitation key to passed to the redirected for further inspection. This is used to implement a pairing model in my case.

valberg commented 1 year ago

I'm not entirely sure how django behaves when providing a keyword argument to an URL which does not take said argument. We would have to make sure that this is backwards compatible.

blag commented 8 months ago

Judging from here and here, you should be able to pair inviter/invitees before the redirect is returned by defining a signal handler that connects to invitations.signals.invite_accepted:

@receiver(invite_accepted, sender=Invitation)
def handle_invite_accepted(sender, email, request, invitation):
    inviter = invitation.inviter
    invitee = request.user
    ...

@shawnzam Does this work for you?

Flimm commented 3 months ago

Thanks for this contribution. I'm not sure if other people will find it helpful, especially given the workaround given by @blag. I'm closing this pull request to avoid it stagnating.