Search code examples
djangodjango-allauthdjango-invitations

How can I get a list of pending invitations for a user using django-invitations?


I can see in the source code for django-invitations that there is a manager with an all_valid method but I'm having trouble connecting the dots back to request.user.

I'm also using django-allauth.


Solution

  • You can use this if you want to get invitations sent for the current user:

    Invitation.objects.all_valid().filter(
        email__iexact=request.user.email, accepted=False,
    )