class inviter.forms.OptOutForm(data=None, files=None, auto_id='id_%s', prefix=None, initial=None, error_class=<class 'django.forms.util.ErrorList'>, label_suffix=':', empty_permitted=False, instance=None)

Dummy form for opting out.


Delete the user object from the database and store the SHA1 hashed email address in the database to make sure this person does not receive any further invitation emails.

class inviter.forms.RegistrationForm(*args, **kwargs)

The standard form that is displayed to users when registering. It gives a user the option to change their email address.


class inviter.models.OptOut(*args, **kwargs)

Opt-out email addresses are stored as SHA1 hashes to make sure we don’t accidentally collect any more data once a person signalled they’re not interested in receiving any more invitation emails from us.


inviter.urls.urlpatterns = [<RegexURLPattern done ^done/$>, <RegexURLPattern register ^register/(?P<uidb36>[0-9A-Za-z]{1,13})-(?P<token>[0-9A-Za-z]+)/$>, <RegexURLPattern opt-out ^optout/(?P<uidb36>[0-9A-Za-z]{1,13})-(?P<token>[0-9A-Za-z]+)/$>, <RegexURLPattern opt-out-done ^optout/done/$>]
Name :done
Name :register
Name :opt-out
Name :opt-out-done


inviter.utils.invite(email, inviter, sendfn=<function send_invite at 0x2fda578>, resend=True, **kwargs)

Invite a given email address and return a (User, sent) tuple similar to the Django django.db.models.Manager.get_or_create() method.

If a user with email address does not exist:

  • Creates a django.contrib.auth.models.User object
  • Set = email
  • Set user.is_active = False
  • Set a random password
  • Send the invitation email
  • Return (user, True)

If a user with email address exists and user.is_active == False:

  • Re-send the invitation
  • Return (user, True)

If a user with email address exists:

  • Don’t send the invitation
  • Return (user, False)

If the email address is blocked:

  • Don’t send the invitation
  • Return (None, False)

To customize sending, pass in a new sendfn function as documented by inviter.utils.send_invite:

sendfn = lambda invitee, inviter, **kwargs: 1
invite("", request.user, sendfn = sendfn)         
  • email – The email address
  • inviter – The user inviting the email address
  • sendfn – An email sending function. Defaults to inviter.utils.send_invite
  • resend – Resend email to users that are not registered yet
inviter.utils.send_invite(invitee, inviter, url=None, opt_out_url=None, **kwargs)

Send the default invitation email assembled from inviter/email/subject.txt and inviter/email/body.txt

Both templates will receive all the kwargs.

  • invitee – The invited user
  • inviter – The inviting user
  • url – The invite URL
  • subject_template – The template to render for the subject
  • body_template – The template to render for the body
  • opt_out_url – A URL where users can permanently opt out of invitations


class inviter.views.OptOut(**kwargs)

We want to give the user also the option to not receive any invitations anymore, which is happening in this view and inviter.forms.OptOutForm.

class inviter.views.Register(**kwargs)

A registration view for invited users. The user model already exists - this view just takes care of setting a password and username, and maybe update the email address. Anywho - one can customize the form that is used.


alias of RegistrationForm

get(request, user)

Unfortunately just a copy of django.contrib.auth.views.password_reset_confirm

post(request, user)

Unfortunately just a copy of django.contrib.auth.views.password_reset_confirm

class inviter.views.UserMixin

Handles retrieval of users from the token and does a bit of access management.

dispatch(request, uidb36, token, *args, **kwargs)

Overriding the default dispatch method on Django’s views to do some token validation and if necessary deny access to the resource.

Also passes the user as first argument after the request argument to the handler method.


Import an attribute from a module.

Table Of Contents

Previous topic

Welcome to django-inviter’s documentation!

This Page