django-tellafriend

Contents:

Prerequisites

django-tellafriend requires the following packages to be installed:

You hopefully already installed the first. The latter can be installed by using pip install django-simple-captcha.

Installation

First make sure you have met all prerequisites.

Put tellafriend somewhere on your pythonpath. The easiest way to achieve this is to use pip: pip install django-tellafriend.

Apps

Add the following to your project’s INSTALLED_APPS setting if not already present:

INSTALLED_APPS = (
    # …
    'django.contrib.sites',
    'captcha',
    'tellafriend',
    # …
)

urls.py

Add this to your main urls.py:

urlpatterns = patterns('',
    # …
    (r'^tellafriend/', include('tellafriend.urls')),
    # …
)

Configuration

Currently there are no configuration options, but be sure that I’m planning to add some soon.

Templates

django-tellafriend comes with four templates which are ready for use but can also be overwritten by you. In order to do that create a directory called tellafriend in your main templates directory and place files there with the names below:

tellafriend/tellafriend.html

This is the main template that renders the form for the tell-a-friend functionality. The template context will contain two variables:

tellafriend_form
An instance of tellafriend.forms.TellAFriendForm.
tellafriend_full_url
The URL that shall be recommended.
tellafriend_url
The local part of the URL that shall be recommended – everything after http://servername.

tellafriend/success.html

A simple success confirmation.

tellafriend/email.html

This file is used to render the HTML version of the e-mail that is sent out to the recipient. The template context contains all of the form variables as well as full_url and url.

tellafriend/email.txt

Same as tellafriend/email.html but used to render the plain text version of the e-mail.

License

django-tellafriend is licensed under the MIT license.