Welcome to django-viter’s documentation!

django-viter allows you to invite users to your Django application. Invited users are saved as inactive users in your database and activated upon registration.

Installation

pip install django-viter

Configuration

Add viter, viter.storehandlers.dbstorehandler, django.contrib.sites to your INSTALLED_APPS

INSTALLED_APPS = (
    'django.contrib.sites',
    'viter'
    'viter.sotrehandlers.dbstorehandler'
)

Usage

To invite people make use of viter.viter.Viter.invite_emails

from viter.viter import Viter

Viter.invite_emails(['foo@bar.com', 'bar@foo.com'], request.user)

You can keep track of who invites whom:

from django.contrib.auth.models import User
foo = User.objects.get(username='foo')
invitations = foo.invitations.all()

You can keep track of who use what invitations:

from viter.viter import Viter
from django.contrib.auth.models import User

foo_user = User.objects.get(username='foo')
bar_user = User.objects.get(username='bar')
invitation = foo_user.invitations.all()[0]

viter = Viter()
viter.register_usage(invitation, user=bar_user)

invitation_usages = invitation.usages.all()

bar_use_this_invitations = bar_user.invitations_used.all()

By default viter.viter.Viter.invite_emails will render viter/email/subject.txt and viter/email/body.txt for the email.

Settings

There are a couple of editable settings

VITER_STORE_HANDLER
Default :viter.storehandlers.dbstorehandler.DBStoreHandler
Type :str

This indicate the Store Handler used to store the invitation objects.

VITER_GENERATOR_HANDLER
Default :viter.generatorhandlers.uuidgeneratorhandler.UUIDGeneratorHandler
Type :str

This indicate the Generator Handler used to generate unique ids.

VITER_SENDMAIL_HANDLER
Default :viter.sendmailhandlers.plainsendmailhandler.PlainSendmailHandler
Type :str

This indicate the Sendmail Handler used to construct and send invitation emails.

VITER_URL_NAME
Default :''

The url name to generate the emails urls with reverse(VITER_URL_NAME, args=hash) If not defined viter will use the VITER_URL_STRING.

VITER_URL_STRING
Default :'/?%(hash)s'

The url string to generate the emails urls with VITER_URL_STRING % { hash: hash }.

VITER_FROM_EMAIL
Default :settings.DEFAULT_FROM_EMAIL

The email address used to send invites from

Project Versions

Table Of Contents

Next topic

Viter

This Page