Beispiel #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('/contact/thanks/')
    else:
        form = ContactForm(initial={'subject': 'I love your site!'})
    return render_to_response('contact_form.html', {'form':form})
Beispiel #2
0
def contact(request):
    if request.method == "POST":
        form = ContactForm(request.POST)
        if form.is_valid():
            cd = form.cleaned_data
            send_mail(cd["subjcet"], cd["message"], cd.get("email", "[email protected]"), ["[email protected]"])
            return HttpResponseRedirect("/contact/thanks/")
    else:
        form = ContactForm(initial={"subject": "I love you, Leon!", "fuck": "Please be polite."})
    return render(request, "contact_form.html", {"form": form})
Beispiel #3
0
def contact(request):
    if request.method == 'POST':
        form = ContactForm(request.POST)
        if form.is_valid():
            cd = form.cleaned_data
            return HttpResponse('thank you')
    else:
        form = ContactForm( 
                initial={'subject': 'I love your site!'}
                )
    return render_to_response('contact_form.html',{'form': form}, RequestContext(request) )
Beispiel #4
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(reverse(thanks))
  else:
    form = ContactForm()
  return render_to_response(get_template('contact_form.html'),
                                {'form':form}, 
                                context_instance=RequestContext(request))
Beispiel #5
0
def addContact(request):
    if not request.user.is_authenticated():
        return HttpResponseRedirect(getHost(request) + '/login/?next=%s' % request.path)  
    if request.method == 'POST' :
        form = ContactForm(request.POST)
        if form.is_valid():
            cd = form.cleaned_data
            g = Contact(name=cd['name'], description=cd['description'], user=cd['user'])
            g.create_by = request.user
            g.save()
            return HttpResponseRedirect(getHost(request) + "/contacts/")
    else:
        form = ContactForm()
    return  render_to_response('books/contact_form.html', {'form':form},context_instance=RequestContext(request))
Beispiel #6
0
def contact(request):
    if request.method == 'POST':
        form = ContactForm(request.POST)
        if form.is_valid():
            #con=form.save()
            topic=form.cleaned_data['topic']
            message=form.cleaned_data['message']
            sender=form.cleaned_data['sender']
            send_mail('Feedback from your site: %s'%topic,message,sender,['[email protected]'],fail_silently=False)
            
            return HttpResponseRedirect('/contact/thanks/')
    else:
        form = ContactForm()
    return render(request,'contact.html', {'form': form})
Beispiel #7
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('/contact/thanks/')
	else:
		form = ContactForm(initial={'subject':'I need your site.'})
	return render_to_response('contact_form.html',{'form':form})
Beispiel #8
0
def contacts(request):
	if request.method =="POST":
		form=ContactForm(request.POST);
		if form.is_valid():
			cf = form.cleaned_data
			send_mail(
				cf['subject'],
				cf['message'],
				cf.get('email','[email protected]'),
				['[email protected]'],
				)
			return HttpResponseRedirect('/contact/thanks/')
	else:
		form = ContactForm()
	return render(request,'contact_form.html',{'form':form})
Beispiel #9
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('/contact/thanks')
	else:
		form = ContactForm()
	return render(request,'contact_form.html',{'form':form})
Beispiel #10
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('/contact/thanks/')
    else:
        form = ContactForm(initial={'subject': 'I love your site!'})
    return render(request, 'contact_form.html', {'form': form})
Beispiel #11
0
def contact(request):
    if request.method == 'POST':
        form = ContactForm(request.POST)
        if form.is_valid():
            topic = form.clean_data['topic']
            message = form.clean_data['message']
            sender = form.clean_data.get('sender', '[email protected]')
            send_mail(
                'Feedback from your site, topic: %s' % topic,
                message, sender,
                ['[email protected]']
            )
            return HttpResponseRedirect('/contact/thanks/')
    else:
        form = ContactForm()
    return render_to_response('contact.html', {'form': form})
Beispiel #12
0
def contact(request):
    logger.info("request.method: %s", request.method)
    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('/contact/thanks/')
    else:
        form = ContactForm(
            initial={'subject': 'I love your site!'}
        )
    return render_to_response('contact_form.html', {'form': form}, context_instance=RequestContext(request))
Beispiel #13
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('/contact/thanks')
        else:
            return backToForm(request, form)
    else:
        form = ContactForm(
            initial={'subject':'FAQ', 'message':'Sample text'}
        )
        return backToForm(request, form)
Beispiel #14
0
def contact(request):
        if request.method == 'POST':  # If the form has been submitted...
                form = ContactForm(request.POST)  # A form bound to the POST data
                if form.is_valid():
                        subject = form.cleaned_data['subject']
                        message= form.cleaned_data['message']
                        sender = form.cleaned_data['sender']
                        cc_myself = form.cleaned_data['cc_myself']
                        recipients = ['[email protected]']
                        if cc_myself:
                            recipients.append(sender)
                        return HttpResponse('Thanks')
        else:
                form = ContactForm()  # An unbound form

        return render(
                request,
                'contact.html',
                {'form': form}
        )
Beispiel #15
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['email'],
                ['[email protected]']
            )
            return HttpResponseRedirect('/contatc/thanks')
    else:
        form = ContactForm(initial={'subject': 'I love your site!'})
    return render(request, 'contact_form.html', {'form': form})

        # CAP 7 - Exemplo 1
        # if not request.POST.get('subject'):
        #     errors.append('Enter a subject')
        # if not request.POST.get('message'):
        #     errors.append('Enter a message')
        # if request.POST.get('email') and '@' not in request.POST['email']:
        #     errors.append('Enter a valid e-mail address.')
        #
        # if not errors:
        #     send_mail(
        #         request.POST['subject'],
        #         request.POST['message'],
        #         request.POST.get('email') or '[email protected]',
        #         ['[email protected]']
        #     )
        #     return HttpResponseRedirect('/contact/thanks')
        # return render(request, 'contact_form.html', {
        #     'errors': errors,
        #     'subject': request.POST.get('subject') or '',
        #     'message': request.POST.get('message') or '',
        #     'email': request.POST.get('email') or ''
        # })