Skip to content

Commit

Permalink
coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
bee-keeper committed Dec 7, 2015
1 parent 5fd2da1 commit 2158bf8
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 14 deletions.
48 changes: 35 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,31 +5,55 @@
[![Coverage Status](https://coveralls.io/repos/bee-keeper/django-invitations/badge.svg?branch=devel&service=github)](https://coveralls.io/github/bee-keeper/django-invitations?branch=devel)

###About
A Django invite app for the excellent [django-allauth](https://github.com/pennersr/django-allauth). All emails and messages are fully customisable.
Generic invitations solution with adaptable backend. All emails and messages are fully customisable.

Originally written as an invitations solution for the excellent [django-allauth](https://github.com/pennersr/django-allauth), this app has been refactored to remove the allauth dependency whilst retaining 100% backwards compatibility.

Invitation flow:

* Priviledged user invites prospective user by email (either via Django admin or via dedicated form post)
* 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, their email is confirmed and they are redirected to signup
* Confirmed email is prefilled, and upon signing up with their password they are logged into the site
* User clicks link, their email is confirmed and they are redirected to a preconfigured url (usually signup)
* Upon signing up with their password user is logged into the site


###Installation
###Generic Installation

```
pip install django-invitations
# Add to settings.py (after all-auth), INSTALLED_APPS
# Add to settings.py, INSTALLED_APPS
'invitations',
# Append to urls.py
url(r'^invitations/', include('invitations.urls', namespace='invitations')),
```

###Allauth Integration

As above, but make sure invitations comes after allauth in the INSTALLED_APPS

```
# Add to settings.py, django-allauth setting
ACCOUNT_ADAPTER = 'invitations.models.InvitationsAdapter'
```

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

```
# inviter argument is optional
invite = Invitation.create('email@example.com', 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 seperated 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`
Expand All @@ -52,6 +76,9 @@ Expose a URL for authenticated posting of invitees

URL name of your signup URL.

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

Used for custom integrations. ACCOUNT_ADAPTER overrides this setting

###Signals

Expand All @@ -65,8 +92,3 @@ The following signals are emitted:
Expired and accepted invites can be cleared as so:

`python manage.py clear_expired_invitations`


###Roadmap

* Refactor to make an generic invitations app with pluggable backends
2 changes: 1 addition & 1 deletion invitations/tests/basic/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -447,7 +447,7 @@ def test_admin_form_change(self):
follow=True)

self.assertEqual(response.status_code, 200)
fields = response.context_data['adminform'].form.fields.keys()
fields = list(response.context_data['adminform'].form.fields.keys())
expected_fields = ['email', 'accepted', 'created',
'key', 'sent', 'inviter']
self.assertEqual(fields, expected_fields)

0 comments on commit 2158bf8

Please sign in to comment.