Generic invitations app with support for django-allauth

pip install django-invitations==1.9.3


Django-invitations - Generic invitations app

Build Status

Coverage Status


Generic invitations solution with adaptable backend and support for django-allauth. All emails and messages are fully customisable.

Originally written as an invitations solution for the excellent django-allauth, this app has been refactored to remove the allauth dependency whilst retaining 100% backwards compatibility.

Generic Invitation flow:

  • Priviledged user invites prospective user by email (via either Django admin, form post, JSON post or programmatically)
  • User receives invitation email with confirmation link
  • User clicks link and is redirected to a preconfigured url (default is accounts/signup)

Allauth Invitation flow:

  • As above but..
  • User clicks link, their email is confirmed and they are redirected to signup
  • The signup URL has the email prefilled and upon signing up the user is logged into the site

Generic Installation

pip install django-invitations


# Append to
url(r'^invitations/', include('invitations.urls', namespace='invitations')),

# Run migrations

python migrate

Allauth Integration

As above but note that invitations must come after allauth in the INSTALLED_APPS

# Add to
ACCOUNT_ADAPTER = 'invitations.models.InvitationsAdapter'

Sending Invites

First import the model:

from invitations.utils import get_invitation_model

Make an instance of the model:

Invitation = get_invitation_model()

Then finally pass the recipient to the model and send.

# inviter argument is optional
invite = Invitation.create('', inviter=request.user)

To send invites via django admin, just add an invite and save.

Bulk Invites

Bulk invites are supported via JSON. Post a list of comma separated emails to the dedicated URL and Invitations will return a data object containing a list of valid and invalid invitations.


python test or tox

Additional Configuration


    Integer. How many days before the invitation expires.


    Boolean. If the site is invite only, or open to all (only relevant when using allauth).


    Boolean. If confirmations can be accepted via a GET request.


    Boolean. If True, invitations will be accepted after users finish signup. If False, invitations will be accepted right after the invitation link is clicked. Note that this only works with Allauth for now, which means ACCOUNT_ADAPTER has to be 'invitations.models.InvitationsAdapter'.


    Boolean. If True, return an HTTP 410 GONE response if the invitation key is invalid, or the invitation is expired or previously accepted when accepting an invite. If False, display an error message and redirect on errors:

    • Redirects to INVITATIONS_SIGNUP_REDIRECT on an expired key
    • Otherwise, redirects to INVITATIONS_LOGIN_REDIRECT on other errors.

    Expose a URL for authenticated posting of invitees

  • INVITATIONS_SIGNUP_REDIRECT (default='account_signup')

    URL name of your signup URL.

  • INVITATIONS_LOGIN_REDIRECT (default=LOGIN_URL from Django settings)

    URL name of your login URL.

  • INVITATIONS_ADAPTER (default='invitations.adapters.BaseInvitationsAdapter')

    Used for custom integrations. Set this to ACCOUNT_ADAPTER if using django-allauth.


    If set to None (the default), invitation email max length will be set up to 254. Set this to an integer value to set up a custome email max length value.


    If set to None (the default), invitation email subjects will be prefixed with the name of the current Site in brackets (such as []). Set this to a string to for a custom email subject prefix, or an empty string for no prefix.

  • INVITATIONS_INVITATION_MODEL (default=invitations.Invitation)

    App registry path of the invitation model used in the current project, for customization purposes.


The following signals are emitted:

  • invite_url_sent
  • invite_accepted

Management Commands

Expired and accepted invites can be cleared as so:

python clear_expired_invitations