Welcome to Django Invite’s documentation!¶
Contents:
Quickstart¶
Requirements¶
- The Django Sites framework must be installed. See the Django Docs for more information.
- The appropriate EmailBackend will need to be configured. See the Django Docs for more information.
Note
If the Sites framework was not previously installed, make sure you configure the domain and name. Those values are used to create urls for invited users. Upon installation of the Sites framework, both values default to example.com
Installation¶
pip install git+https://github.com/unt-libraries/django-invite.git@3.0.0
Add
invite
to yourINSTALLED_APPS
Run
./manage.py migrate
Add the following to your root
urls.py
.urlpatterns = [ ... url(r'^invite/', include('invite.urls', namespace='invite')) ]
How it Works¶
Invitations are sent via email with a activation link for each invited user. When the new user follows the link, they are given a form to edit their information and provide a password. Once successfully submitted, the activation link for that user is no longer valid.
After the a new user completes the signup form, he/she is automatically authenticated and redirected to the value of settings.INVITE_SIGNUP_SUCCESS_URL
Authentication is required by most views in the Invite app, and only users with the correct permission are able to invite new users (see Permissions)
Configuration¶
Invite provides 4 configurable settings that can be customized by including them in your projects settings files.
Settings¶
INVITE_LOGOUT_REDIRECT_URL
¶
Optional
Default : reverse('invite:index')
Where your users would be redirected to upon logging out from within the Invite app.
INVITE_SIGNUP_SUCCESS_URL
¶
Optional
Default : reverse('invite:index')
Where the user will be redirected to upon successfully completing the signup form.
INVITE_SERVICE_NAME
¶
Optional
Default : Site.objects.get_current().domain
This setting is used in the to create a customized email that is sent to the invited user.
INVITE_DEFAULT_FROM_EMAIL
¶
Optional
Default : django.conf.settings.DEFAULT_FROM_EMAIL
The ‘From’ field for emails sent via the Invite app.
INVITE_SHOW_EMAILS
¶
Optional
Default : False
Whether or not to show superusers and users with invitation permission the emails associated with invitations/registrations on the accounts page.
INVITE_OPEN_INVITE_CUTOFF
¶
Optional
Default : None
Defines a time period (in days back from today) for displaying open invitations. Open invitations older than that will not be shown on the accounts page. A value of None will be interpreted to mean that all open invitations should be shown, while a value of 0 means none should be shown.
INVITE_REGISTRATION_CUTOFF
¶
Optional
Default : None
Defines a time period (in days back from today) for displaying registrations. Registrations older than that will not be shown on the accounts page. A value of None will be interpreted to mean that all registrations should be shown, while a value of 0 means none should be shown.
Permissions¶
Like standard Django models, there are a number of permissions associated with the invite models. One in particular is important, as it determines which users are allowed to invite new users your project.
invite.add_invitation
Note
If a user does not have this permission, they will still have limited access to pages included in the Invite app. Such users will only be shown a list of recent registrations and recently sent open invitations. They will not have access to the invitation form.
Password Reset¶
Invite also includes a password reset form. You can link to this in any of your templates with {% url 'invite:amnesia' %}