Esempio n. 1
0
def contact(request):
    if request.method == 'POST':
        form = ContactForm(request.POST)
        if form.is_valid():
            cd = form.cleaned_data
 #           send_mail(cd['subject'],cd['message'],cd.get('email','[email protected]`_'),'[email protected]`_'],)
            return HttpResponseRedirect('/search')
    else:
        form = ContactForm(initial={'subject': 'I love your site!'})
    return render_to_response('contact_form.html', {'form': form})
Esempio n. 2
0
def contact(request):
    if request.method == 'POST':
        form = ContactForm(request.POST)
        if form.is_valid():
            cd = form.cleaned_data
            send_mail(
                cd['subject'],
                cd['message'],
                cd.get('email', '*****@*****.**'),
                ['*****@*****.**'],
            )
            return HttpResponseRedirect('/contact/thanks/')
    else:
        form = ContactForm(initial={'subject': 'I love your site!'})
    return render_to_response('contact_form.html',
        {'form': form}, 
    context_instance=RequestContext(request))