Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Proposal: add invitee field to AbstractBaseInvitation model #252

Open
Flimm opened this issue Jun 14, 2024 · 0 comments
Open

Proposal: add invitee field to AbstractBaseInvitation model #252

Flimm opened this issue Jun 14, 2024 · 0 comments

Comments

@Flimm
Copy link
Contributor

Flimm commented Jun 14, 2024

I would like to add this invitee field to AbstractBaseInvitation model:

class AbstractBaseInvitation(models.Model):
    invitee = models.ForeignKey(
        settings.AUTH_USER_MODEL,
        verbose_name=_("inviter"),
        null=True,
        blank=True,
        on_delete=models.CASCADE,
    )

This invitee field would be null initially. Once the invitee has created a new user account, after clicking the invitation link, the invitee field would set to the ID of the new user account.

I wanted to propose this to see what you would think, before attempting to implement it.

Motivation:

This library has been designed to keep Invitation instances in the database, even after the invitation has been accepted and the user account has been created. The only reason to keep these invitations around is to have a track record of invitations. It seems likely in that case that the inviter would want to be able to interact with the new user account, depending on the application. They may want to visit their profile page or something.

Right now, this is impossible to do, as there is nothing linking the invitation instance to a user instance. At first glance, it might seem that an email address would link both models, but that is not the case. A user is not obligated to sign up with the same email address that was used to invite them. Even if they do use the same email address, they may change their email address in their user account later on. So an email address cannot be relied on to link these two models.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant