Added some production settings. Moving to travis-ci for testing. Added feature to stop new registrations.

This commit is contained in:
Isaac Bythewood
2012-08-01 03:06:41 +00:00
parent 265777e94b
commit d92d30bb94
12 changed files with 44 additions and 111 deletions

View File

@@ -5,6 +5,7 @@ from django.contrib.auth.decorators import login_required
from django.contrib.auth import logout
from django.contrib.auth.forms import UserCreationForm
from django.contrib import messages
from django.conf import settings
def home(request):
@@ -12,6 +13,10 @@ def home(request):
def register(request):
if not settings.ALLOW_NEW_REGISTRATIONS:
messages.error(request, "The admin of this service is currently not "
"allowing new users to register.")
return HttpResponseRedirect(reverse('pins:recent-pins'))
if request.method == 'POST':
form = UserCreationForm(request.POST)
if form.is_valid():
@@ -21,6 +26,7 @@ def register(request):
return HttpResponseRedirect(reverse('core:login'))
else:
form = UserCreationForm()
return TemplateResponse(request, 'core/register.html', {'form': form})