Exemple #1
0
def register(request):
    if request.method == 'POST':
        form = UserCreateForm(request.POST)
        if form.is_valid():
            new_user = form.save()
            return HttpResponseRedirect('/books/')
    else:
        form = UserCreateForm()
    return render_to_response('books/register.html', \
        RequestContext(request, {'form': form, }))
Exemple #2
0
def register(request):
	if request.method == 'POST':
		form = UserCreateForm(request.POST)
		if form.is_valid():
			form.save()
			form_email = form.cleaned_data['email']
			form_username = form.cleaned_data['username']
			#form_full_name = form.cleaned_data.get("full_name")
			subject = 'Your message is received.'
			from_email = settings.EMAIL_HOST_USER
			to_email = [form_email]
			contact_message = """Hi %s: 
Thank you for registering at dukebooktrading. Thank you.

				Duke Book Trading Team""" %(form_username)
			send_mail(subject, contact_message,from_email, to_email,fail_silently = False)
			return HttpResponseRedirect(reverse('books.views.login'))
	else:
		form = UserCreateForm()
	return render_to_response('books/register.html',
		{ 'form':form, }, 
		context_instance = RequestContext(request))