예제 #1
0
def register(request, pid=None):
    
    if request.method == 'POST':
        form = RegistrationForm(request.POST)

        if form.is_valid():
            new_user = form.save()
            user = Profile.objects.get(email=form.cleaned_data['email'])
            if pid:
                partner = Profile.objects.get(id=pid)
                user.partner = partner
                user.save()
            send_outbound_generic_email(
                recipient=user, 
                title="Welcome to Investaview", 
                message="Welcome to the Investaview Community. We look forward to your contributions.", #add copy to direct them to complete filling out profile 
                template="email/generic.html"
            )
            if form.cleaned_data['next']:
                return HttpResponseRedirect(form.cleaned_data['next'])
            else:
                return HttpResponseRedirect(reverse('home'))

    else:
        form = RegistrationForm()
    return render_to_response('account/register.html', {'form': form, }, context_instance=RequestContext(request))
예제 #2
0
def register_partner(request):
    if request.method == 'POST':
        form = PartnerRegistrationForm(request.POST)

        if form.is_valid():
            new_user = form.save()
            user = Profile.objects.get(email=form.cleaned_data['email'])
            send_outbound_generic_email(
                recipient=user, 
                title="Welcome to Investaview", 
                message="Welcome to Investaview.  We look forward to working with you to build our partnership.", 
                template="email/generic.html"
            )
            return HttpResponseRedirect(reverse('partner_dashboard'))

    else:
        form = PartnerRegistrationForm()
    return render_to_response('partner/registration.html', {'form': form, }, context_instance=RequestContext(request))