from django import newforms as forms class Email forms Form subject fo

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
from django import newforms as forms
class Email(forms.Form):
subject = forms.CharField(max_length=100)
message = forms.CharField()
def contact(request):
if request.method == 'POST':
form = ContactForm(request.POST)
if form.is_valid(): # Do form processing here...
return HttpResponseRedirect('/url/on_success/')
else:
form = ContactForm()
return render_to_response('contact.html', {'form': form})