Example #1
0
def contact(request):
    if request.method == 'POST':
        form = ContactForm(request.POST)
        if form.is_valid():
            contact=form.save(commit=False)
            contact.contact_version = get_active_version()
            contact.save()
            cd = form.cleaned_data
            email = EmailMessage("CS2J Online Contact from %s" % cd['name'],
                                 "Name: %(name)s\nEmail: %(email)s\nPhone: %(phone)s\nVersion: %(contact_version)s\nMessage: %(comment)s" % dict(contact_version = get_active_version(), **cd),
                                 '*****@*****.**',
                                 ['*****@*****.**'],
                                 headers = {'Reply-To':  cd.get('email')})
            email.send()
            return HttpResponseRedirect(reverse('webapp.views.contact_thanks'))
    else:
        form = ContactForm()
    return render_to_response('twiglet/contact_form.html', {'form': form}, context_instance=RequestContext(request))
Example #2
0
def download_thanks(request):
    if request.method == 'POST':
        form = DownloadForm(request.POST)
        if form.is_valid():
            download=form.save(commit=False)
            download.download_version = get_active_version()
            download.save()
            cd = form.cleaned_data
            email = EmailMessage("CS2J download by %s" % cd['name'],
                                 "Name: %(name)s\nEmail: %(email)s\nPhone: %(phone)s\nVersion: %(download_version)s\nMessage: %(comment)s" % dict(download_version = get_active_version(), **cd),

                                 '*****@*****.**',
                                 ['*****@*****.**'],
                                 headers = {'Reply-To':  cd.get('email')})
            email.send()
            request.session['allow_trial_download'] = True
            return HttpResponseRedirect(reverse('webapp.views.download_thanks_thanks'))
    else:
        form = DownloadForm()
    return render_to_response('twiglet/download_thanks.html', {'form': form}, context_instance=RequestContext(request))