Exemple #1
0
def my_contact(request): #ref from URL's
    if request.method == 'POST':
        form = ContactForm(request.POST)#reference forms.py
        if form.is_valid():
            my_contacts = ContactModel()#reference models.py
            my_contacts.name = form.cleaned_data['name']
            my_contacts.address = form.cleaned_data['address']
            my_contacts.city = form.cleaned_data['city']
            my_contacts.state = form.cleaned_data['state']
            my_contacts.zip = form.cleaned_data['zip']
            my_contacts.phone = form.cleaned_data['phone']
            my_contacts.email = form.cleaned_data['email']
            my_contacts.subject = form.cleaned_data['subject']
            my_contacts.message = form.cleaned_data['message']
            my_contacts.save()
            return redirect('received')
    else:
        form = ContactForm() #unbound form
    return render_to_response('contact/wtfcontacts.html',{'form':form}, context_instance=RequestContext(request)) #need to fill in URL
Exemple #2
0
def dolai_contact(request):
	if request.method == 'POST': #does this need to be capitalized? I wonder what will happen if I take that away. Remember to try that later
		form = ContactForm(request.POST)
		if form.is_valid():
			my_contacts = ContactModel()
			my_contacts.name = form.cleaned_data['name']
			my_contacts.address = form.cleaned_data['address']
			my_contacts.city = form.cleaned_data['city']
			my_contacts.state = form.cleaned_data['state']
			my_contacts.zip = form.cleaned_data['zip']
			my_contacts.phone = form.cleaned_data['phone']
			my_contacts.email = form.cleaned_data['email']
			my_contacts.subject = form.cleaned_data['subject']
			my_contacts.message = form.cleaned_data['message']
			my_contacts.save()
			return redirect('received')
	else:
		form = ContactForm()
	return render_to_response('contact/dolaicontact.html',{'form':form}, context_instance=RequestContext(request))