tswicegood / django-privatebeta forked from pragmaticbadger/django-privatebeta
- Source
- Commits
- Network (2)
- Downloads (0)
- Wiki (1)
- Graphs
-
Branch:
master
| name | age | message | |
|---|---|---|---|
| |
LICENSE | Tue Oct 06 22:50:21 -0700 2009 | |
| |
README.rst | ||
| |
privatebeta/ | ||
| |
setup.py |
django-privatebeta
This reusable Django applications provides two things useful to a site under private (closed) beta:
- A form that allows users to enter their email address so that you can send them an invite or a site launch notification later.
- A middleware that locks the site down for non-logged in users. If you control account creation this is a very effective way of limiting a site to beta testers only.
Email invite form
To use the invite form, you first need to add privatebeta to INSTALLED_APPS in your settings file:
INSTALLED_APPS = ( ... 'privatebeta', )
You will also need to add
urlpatterns = patterns('',
...
(r'^invites/', include('privatebeta.urls')),
)
You will also need to create two templates. The first is privatebeta/invite.html:
{% extends 'base.html' %}
{% block content %}
<h3>Enter your email address and we'll send you an invite soon</h3>
<form action="{% url privatebeta_invite %}" method="post">
{{ form }}
<input type="submit" value="Submit" />
</form>
{% endblock %}
When an email address is successfully entered, the user will be redirected to privatebeta/sent.html:
{% extends 'base.html' %}
{% block content %}
<p>Thanks, we'll be in touch!</p>
{% endblock %}
The above templates assume a standard Django template structure with a base.html template and a content block.
The included views take two optional keyword arguments for flexibility.:
Closed beta middleware
If you would also like to prevent non-logged-in users from viewing your site, you can make use of privatebeta.middleware.PrivateBetaMiddleware. This middleware redirects all views to a specified location if a user is not logged in.
To use the middleware, add it to MIDDLEWARE_CLASSSES in your settings file:
MIDDLEWARE_CLASSES = (
...
'privatebeta.middleware.PrivateBetaMiddleware',
)
There are a few settings that influence behavior of the middleware:
Similar projects
- Pinax includes a private beta project that shows how to dynamically enable or disable account creation in your urlconf in concert with a setting. It also includes a signup code app that allows you to create beta codes with a limited number of uses.
- django-invitation is a reusable application designed to allow existing beta users to invite new users to the site for a viral beta. It builds on top of django-registration and can require an invite before a user is allowed to create an account.
- django-invite is a lighter weight reusable application designed to restrict logins via an invite system.

