def process_used_signup_code(sender, **kwargs): result = kwargs.get("signup_code_result") try: invite = result.signup_code.joininvitation invite.to_user = result.user invite.status = JoinInvitation.STATUS_ACCEPTED invite.save() stat = invite.from_user.invitationstat stat.invites_accepted += 1 stat.save() invite_accepted.send(sender=JoinInvitation, invitation=invite) except JoinInvitation.DoesNotExist: pass
def accept(self, user): self.to_user = user self.status = JoinInvitation.STATUS_ACCEPTED self.save() self.from_user.invitationstat.increment_accepted() invite_accepted.send(sender=JoinInvitation, invitation=self)