Git Product home page Git Product logo

django-invitations's Introduction

##Django-invitations - Generic invitations app

Build Status

Coverage Status

###About 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

# Add to settings.py, INSTALLED_APPS
'invitations',

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

###Allauth Integration

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

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

###Sending Invites

# inviter argument is optional
invite = Invitation.create('[email protected]', inviter=request.user)
invite.send_invitation(request)

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.

###Testing

python manage.py test or tox

###Additional Configuration

  • INVITATIONS_INVITATION_EXPIRY (default=3)

    Integer. How many days before the invitation expires.

  • INVITATIONS_INVITATION_ONLY (default=False)

    Boolean. If the site is invite only, or open to all.

  • INVITATIONS_CONFIRM_INVITE_ON_GET (default=True)

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

  • INVITATIONS_GONE_ON_ACCEPT_ERROR (default=True)

    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.
  • INVITATIONS_ALLOW_JSON_INVITES (default=False)

    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.

###Signals

The following signals are emitted:

  • invite_url_sent
  • invite_accepted

###Management Commands Expired and accepted invites can be cleared as so:

python manage.py clear_expired_invitations

django-invitations's People

Contributors

bee-keeper avatar clokep avatar mjnaderi avatar simonv3 avatar tbarbugli avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.